mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 169628
This commit is contained in:
parent
ce9cf841bd
commit
3d06ebc729
2 changed files with 20 additions and 3 deletions
|
@ -1986,4 +1986,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertSame(blah, col.getName(15).resolveBinding());
|
assertSame(blah, col.getName(15).resolveBinding());
|
||||||
assertSame(c2, col.getName(16).resolveBinding());
|
assertSame(c2, col.getName(16).resolveBinding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug169628() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("template< class T > class C {}; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("typedef struct C<int> CInt; \n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP, true, true );
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept( col );
|
||||||
|
|
||||||
|
assertTrue( col.getName(2).resolveBinding() instanceof ICPPSpecialization );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,8 +220,9 @@ public class CPPTemplates {
|
||||||
parent instanceof ICPPASTElaboratedTypeSpecifier && segment != 0 )
|
parent instanceof ICPPASTElaboratedTypeSpecifier && segment != 0 )
|
||||||
{
|
{
|
||||||
return createClassExplicitInstantiation( (ICPPASTElaboratedTypeSpecifier) parent );
|
return createClassExplicitInstantiation( (ICPPASTElaboratedTypeSpecifier) parent );
|
||||||
} else if( (parent instanceof ICPPASTElaboratedTypeSpecifier ||
|
} else if( ( (parent instanceof ICPPASTElaboratedTypeSpecifier && decl instanceof ICPPASTTemplateDeclaration) ||
|
||||||
parent instanceof ICPPASTCompositeTypeSpecifier ) && segment != 0 ){
|
parent instanceof ICPPASTCompositeTypeSpecifier )
|
||||||
|
&& segment != 0 ){
|
||||||
return createClassSpecialization( (ICPPASTDeclSpecifier) parent );
|
return createClassSpecialization( (ICPPASTDeclSpecifier) parent );
|
||||||
} else if( parent instanceof ICPPASTFunctionDeclarator && segment != 0 ){
|
} else if( parent instanceof ICPPASTFunctionDeclarator && segment != 0 ){
|
||||||
return createFunctionSpecialization( id );
|
return createFunctionSpecialization( id );
|
||||||
|
@ -229,7 +230,11 @@ public class CPPTemplates {
|
||||||
|
|
||||||
//a reference: class or function template?
|
//a reference: class or function template?
|
||||||
IBinding template = null;
|
IBinding template = null;
|
||||||
if( parent instanceof ICPPASTNamedTypeSpecifier || parent instanceof ICPPASTBaseSpecifier || segment == 0 ){
|
if( parent instanceof ICPPASTNamedTypeSpecifier ||
|
||||||
|
parent instanceof ICPPASTElaboratedTypeSpecifier ||
|
||||||
|
parent instanceof ICPPASTBaseSpecifier ||
|
||||||
|
segment == 0 )
|
||||||
|
{
|
||||||
//class template
|
//class template
|
||||||
IASTName templateName = id.getTemplateName();
|
IASTName templateName = id.getTemplateName();
|
||||||
template = templateName.resolveBinding();
|
template = templateName.resolveBinding();
|
||||||
|
|
Loading…
Add table
Reference in a new issue