mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
fix bug 86306
This commit is contained in:
parent
18201b4720
commit
90832556ab
2 changed files with 45 additions and 3 deletions
|
@ -2069,7 +2069,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
assertTrue( r.getReturnValue() instanceof IASTCastExpression );
|
assertTrue( r.getReturnValue() instanceof IASTCastExpression );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug84476() throws Exception
|
public void testBug84476() throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
// buffer.append( "struct B { int f();};\n"); //$NON-NLS-1$
|
// buffer.append( "struct B { int f();};\n"); //$NON-NLS-1$
|
||||||
|
@ -2083,5 +2083,46 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
String code = buffer.toString();
|
String code = buffer.toString();
|
||||||
parse( code, ParserLanguage.CPP );
|
parse( code, ParserLanguage.CPP );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug86336() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("struct T1 { \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" T1 operator() ( int x ) { \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" return T1(x); \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" } \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" T1( int ) {} \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("}; \n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.getVisitor().visitTranslationUnit(col);
|
||||||
|
|
||||||
|
ICPPConstructor T1_ctor = (ICPPConstructor) col.getName(6).resolveBinding();
|
||||||
|
ICPPClassType T1 = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
|
||||||
|
assertInstances( col, T1_ctor, 2 );
|
||||||
|
assertInstances( col, T1, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug86306() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("struct S { int i; }; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void foo() { \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();
|
||||||
|
tu.getVisitor().visitTranslationUnit(col);
|
||||||
|
|
||||||
|
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
|
||||||
|
assertInstances( col, S, 3 );
|
||||||
|
|
||||||
|
IASTName [] refs = tu.getReferences( S );
|
||||||
|
assertEquals( refs.length, 2 );
|
||||||
|
assertSame( refs[0], col.getName(4) );
|
||||||
|
assertSame( refs[1], col.getName(7) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -923,7 +923,8 @@ public class CPPVisitor implements ICPPASTVisitor {
|
||||||
prop == ICPPASTPointerToMember.NAME ||
|
prop == ICPPASTPointerToMember.NAME ||
|
||||||
prop == ICPPASTTypenameExpression.TYPENAME ||
|
prop == ICPPASTTypenameExpression.TYPENAME ||
|
||||||
prop == ICPPASTUsingDeclaration.NAME ||
|
prop == ICPPASTUsingDeclaration.NAME ||
|
||||||
prop == ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.NAME)
|
prop == ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.NAME ||
|
||||||
|
p2 == ICPPASTQualifiedName.SEGMENT_NAME )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue