1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00

fix bug 98784

This commit is contained in:
Andrew Niefer 2005-06-08 15:58:40 +00:00
parent 164b25ecae
commit 6461cf1c92
2 changed files with 18 additions and 0 deletions

View file

@ -1657,4 +1657,20 @@ public class AST2TemplateTests extends AST2BaseTest {
assertSame( i, col.getName(14).resolveBinding() );
}
public void testBug98784() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("class A { \n"); //$NON-NLS-1$
buffer.append(" template <class T > void f( T ) { \n"); //$NON-NLS-1$
buffer.append(" begin(); \n"); //$NON-NLS-1$
buffer.append(" } \n"); //$NON-NLS-1$
buffer.append(" void begin(); \n"); //$NON-NLS-1$
buffer.append("}; \n"); //$NON-NLS-1$
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
CPPNameCollector col = new CPPNameCollector();
tu.accept( col );
assertSame( col.getName(5).resolveBinding(), col.getName(6).resolveBinding() );
}
}

View file

@ -297,6 +297,8 @@ public class CPPSemantics {
parent = parent.getParent();
}
if( parent instanceof IASTFunctionDefinition ){
while( parent.getParent() instanceof ICPPASTTemplateDeclaration )
parent = parent.getParent();
if( parent.getPropertyInParent() != IASTCompositeTypeSpecifier.MEMBER_DECLARATION )
return false;