mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 71410.
move test FailedCompleteParseASTTest.testInheritsFromTemplateParameter_bug71410() to CompleteParseASTTemplateTest.java
This commit is contained in:
parent
c545faa301
commit
e803a76b2a
3 changed files with 16 additions and 20 deletions
|
@ -204,25 +204,6 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest
|
|||
// assertFalse(j.hasNext());
|
||||
}
|
||||
|
||||
public void testInheritsFromTemplateParameter_bug71410() throws Exception {
|
||||
try {
|
||||
// An inner type definition inherits from a template parameter
|
||||
parse("template <typename T, class U> \n class A { \n struct B : U { T* mpT; }; \n B mB; \n T* foo() { return mB.mpT; } \n }; \n");//$NON-NLS-1$
|
||||
fail();
|
||||
} catch (ParserException e) {
|
||||
assertTrue( e.getMessage().equals( "FAILURE" ) ); //$NON-NLS-1$
|
||||
}
|
||||
// Iterator i = parse("template <typename T, class U> \n class A { \n struct B : U { T* mT; }; \n B mB; \n T* getVal() { return mB.mT; } \n }; \n").getDeclarations();//$NON-NLS-1$
|
||||
// IASTTemplateDeclaration td = (IASTTemplateDeclaration)i.next();
|
||||
// assertFalse(i.hasNext());
|
||||
// IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration();
|
||||
// Iterator j = cs.getDeclarations();
|
||||
// IASTClassSpecifier cs2 = (IASTClassSpecifier) j.next();
|
||||
// IASTField f = (IASTField) j.next();
|
||||
// IASTMethod m = (IASTMethod) j.next();
|
||||
// assertFalse(j.hasNext());
|
||||
}
|
||||
|
||||
public void testParametrizedTypeDefinition_bug69751() throws Exception {
|
||||
try {
|
||||
// a typedef refers to an unknown type in a template parameter
|
||||
|
|
|
@ -1044,4 +1044,17 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest {
|
|||
assertEquals( clause.getParentClassSpecifier(), B1cls );
|
||||
|
||||
}
|
||||
|
||||
public void testInheritsFromTemplateParameter_bug71410() throws Exception {
|
||||
// An inner type definition inherits from a template parameter
|
||||
Iterator i = parse("template <typename T, class U> \n class A { \n struct B : U { T* mT; }; \n B mB; \n T* getVal() { return mB.mT; } \n }; \n").getDeclarations();//$NON-NLS-1$
|
||||
IASTTemplateDeclaration td = (IASTTemplateDeclaration)i.next();
|
||||
assertFalse(i.hasNext());
|
||||
IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration();
|
||||
Iterator j = cs.getDeclarations();
|
||||
IASTClassSpecifier cs2 = (IASTClassSpecifier) j.next();
|
||||
IASTField f = (IASTField) j.next();
|
||||
IASTMethod m = (IASTMethod) j.next();
|
||||
assertFalse(j.hasNext());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -651,7 +651,9 @@ public class ParserSymbolTable {
|
|||
{
|
||||
wrapper = (IDerivableContainerSymbol.IParentSymbol) scopes.get(i);
|
||||
ISymbol parent = wrapper.getParent();
|
||||
if( parent == null )
|
||||
|
||||
//skip if parent is template parameter
|
||||
if( parent == null || parent.isType( ITypeInfo.t_templateParameter ) )
|
||||
continue;
|
||||
|
||||
if( !wrapper.isVirtual() || !data.visited.containsKey( parent ) ){
|
||||
|
|
Loading…
Add table
Reference in a new issue