diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 43483d669aa..651ee9f60b0 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -1425,5 +1425,19 @@ public class AST2CPPTests extends AST2BaseTest { assertInstances( col, mutate, 2 ); assertInstances( col, B, 2 ); } + + public void testBug84469() throws Exception { + StringBuffer buffer = new StringBuffer(); + buffer.append("struct S { int i; }; \n"); //$NON-NLS-1$ + buffer.append("void f() { ; \n"); //$NON-NLS-1$ + buffer.append(" int S::* pm = &S::i; \n"); //$NON-NLS-1$ + buffer.append("} \n"); //$NON-NLS-1$ + + IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP ); + CPPNameCollector col = new CPPNameCollector(); + CPPVisitor.visitTranslationUnit(tu, col); + + assertEquals( 9, col.size() ); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java index 4cb002e85a6..b6b942c3ef8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java @@ -967,7 +967,9 @@ public class CPPVisitor { if( name instanceof ICPPASTQualifiedName ){ IASTName [] names = ((ICPPASTQualifiedName)name).getNames(); for( int i = 0; i < names.length; i++ ){ - if( !visitName( names[i], action ) ) return false; + if( i == names.length - 1 ){ + if( names[i].toCharArray().length > 0 && !visitName( names[i], action ) ) return false; + } else if( !visitName( names[i], action ) ) return false; } } return true; @@ -1031,6 +1033,15 @@ public class CPPVisitor { } } + IASTPointerOperator [] ptrs = declarator.getPointerOperators(); + if( ptrs.length > 0 ){ + for( int i = 0; i < ptrs.length; i++ ){ + if( ptrs[i] instanceof ICPPASTPointerToMember ){ + if( !visitName( ((ICPPASTPointerToMember) ptrs[i]).getName(), action ) ) return false; + } + } + } + if( declarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR && declarator.getNestedDeclarator() == null ) {