mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
fix bug 84703
This commit is contained in:
parent
34ee61a5f8
commit
ad34c22138
2 changed files with 27 additions and 0 deletions
|
@ -1400,5 +1400,30 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
IProblemBinding problem = (IProblemBinding) col.getName(12).resolveBinding();
|
IProblemBinding problem = (IProblemBinding) col.getName(12).resolveBinding();
|
||||||
assertEquals( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, problem.getID() );
|
assertEquals( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, problem.getID() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug84703() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("struct B { \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append(" void mutate(); \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append("}; \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append("void g() { \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append(" B* pb = new B(); \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append(" pb->mutate(); \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( 8, col.size() );
|
||||||
|
|
||||||
|
ICPPMethod mutate = (ICPPMethod) col.getName(1).resolveBinding();
|
||||||
|
ICPPClassType B = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
IVariable pb = (IVariable) col.getName(4).resolveBinding();
|
||||||
|
|
||||||
|
assertInstances( col, pb, 2 );
|
||||||
|
assertInstances( col, mutate, 2 );
|
||||||
|
assertInstances( col, B, 2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -800,6 +800,8 @@ public class CPPVisitor {
|
||||||
if( name instanceof ICPPASTQualifiedName ) return PROCESS_CONTINUE;
|
if( name instanceof ICPPASTQualifiedName ) return PROCESS_CONTINUE;
|
||||||
|
|
||||||
ASTNodeProperty prop = name.getPropertyInParent();
|
ASTNodeProperty prop = name.getPropertyInParent();
|
||||||
|
if( prop == ICPPASTQualifiedName.SEGMENT_NAME )
|
||||||
|
prop = name.getParent().getPropertyInParent();
|
||||||
|
|
||||||
switch( kind ){
|
switch( kind ){
|
||||||
case KIND_LABEL:
|
case KIND_LABEL:
|
||||||
|
|
Loading…
Add table
Reference in a new issue