diff --git a/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java index f2029c2375e..7f4871bd7b0 100644 --- a/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTTest.java @@ -183,32 +183,7 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest // assertFalse(k.hasNext()); } - public void testTemplateFunctionInsideTemplateType_bug71588() throws Exception { - StringWriter writer = new StringWriter(); - writer.write("template \r\n"); //$NON-NLS-1$ - writer.write("class A { \n"); //$NON-NLS-1$ - writer.write("template \n"); //$NON-NLS-1$ - writer.write("T* foo(V); \n"); //$NON-NLS-1$ - writer.write("}; \n"); //$NON-NLS-1$ - writer.write("template \n"); //$NON-NLS-1$ - writer.write("template \n"); //$NON-NLS-1$ - writer.write("T* A::foo(V) { return (T*)0; } \n"); //$NON-NLS-1$ - try { - parse(writer.toString()); - } catch (Throwable e) { - assertTrue( e instanceof AssertionFailedError ); - } -// Iterator i = parse(writer.toString()).getDeclarations(); -// IASTTemplateDeclaration td = (IASTTemplateDeclaration) i.next(); -// IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration(); -// Iterator j = cs.getDeclarations(); -// IASTTemplateDeclaration td2 = (IASTTemplateDeclaration) j.next(); -// assertFalse(j.hasNext()); -// IASTMethod mdec = (IASTMethod) td2.getOwnedDeclaration(); -// IASTTemplateDeclaration td3 = (IASTTemplateDeclaration) i.next(); -// assertFalse(i.hasNext()); -// IASTMethod mdef = (IASTMethod) td3.getOwnedDeclaration(); - } + public void testGNUExternalTemplate_bug71603() throws Exception { try { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java index 239895926ee..e41a77af15c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTemplateTest.java @@ -17,6 +17,8 @@ import java.io.StringWriter; import java.io.Writer; import java.util.Iterator; +import junit.framework.AssertionFailedError; + import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; @@ -1068,4 +1070,27 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest { IASTTemplateDeclaration tmd = (IASTTemplateDeclaration) j.next(); assertFalse(j.hasNext()); } + + public void testTemplateFunctionInsideTemplateType_bug71588() throws Exception { + StringWriter writer = new StringWriter(); + writer.write("template \r\n"); //$NON-NLS-1$ + writer.write("class A { \n"); //$NON-NLS-1$ + writer.write("template \n"); //$NON-NLS-1$ + writer.write("T* foo(V); \n"); //$NON-NLS-1$ + writer.write("}; \n"); //$NON-NLS-1$ + writer.write("template \n"); //$NON-NLS-1$ + writer.write("template \n"); //$NON-NLS-1$ + writer.write("T* A::foo(V) { return (T*)0; } \n"); //$NON-NLS-1$ + + Iterator i = parse(writer.toString()).getDeclarations(); + IASTTemplateDeclaration td = (IASTTemplateDeclaration) i.next(); + IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration(); + Iterator j = cs.getDeclarations(); + IASTTemplateDeclaration td2 = (IASTTemplateDeclaration) j.next(); + assertFalse(j.hasNext()); + IASTMethod mdec = (IASTMethod) td2.getOwnedDeclaration(); + IASTTemplateDeclaration td3 = (IASTTemplateDeclaration) i.next(); + assertFalse(i.hasNext()); + IASTMethod mdef = (IASTMethod) td3.getOwnedDeclaration(); + } }