diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 62009fc5169..ef576a12c5a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -102,6 +102,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException; public class AST2CPPTests extends AST2BaseTest { + public void testBug43241() throws Exception { + parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$ + } + public void testBug40768() throws Exception { StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$ buffer.append( "int (*zzz2) (char); \n" ); //$NON-NLS-1$ @@ -113,6 +117,15 @@ public class AST2CPPTests extends AST2BaseTest { assertNoProblemBindings( col ); } + protected void parseAndCheckBindings( String code ) throws Exception + { + IASTTranslationUnit tu = parse( code, ParserLanguage.CPP ); //$NON-NLS-1$ + CPPNameCollector col = new CPPNameCollector(); + tu.accept(col); + assertNoProblemBindings( col ); + } + + public void testBug40422() throws Exception { IASTTranslationUnit tu = parse( "class A { int y; }; int A::* x = 0;", ParserLanguage.CPP ); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index cfca3c4551c..401c22710e1 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -77,7 +77,6 @@ import org.eclipse.cdt.core.dom.ast.c.ICArrayType; import org.eclipse.cdt.core.dom.ast.c.ICExternalBinding; import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope; import org.eclipse.cdt.core.parser.ParserLanguage; -import org.eclipse.cdt.core.parser.tests.ast2.AST2BaseTest.CPPNameCollector; import org.eclipse.cdt.internal.core.dom.parser.ASTNode; import org.eclipse.cdt.internal.core.dom.parser.c.CFunction; import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor; @@ -90,6 +89,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException; */ public class AST2Tests extends AST2BaseTest { +// public void testBug43241() throws Exception { +// parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$ +// } + public void testBug40768() throws Exception { StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$ buffer.append( "int (*zzz2) (char); \n" ); //$NON-NLS-1$ @@ -101,6 +104,14 @@ public class AST2Tests extends AST2BaseTest { assertNoProblemBindings( col ); } + protected void parseAndCheckBindings( String code ) throws Exception + { + IASTTranslationUnit tu = parse( code, ParserLanguage.C ); //$NON-NLS-1$ + CNameCollector col = new CNameCollector(); + tu.accept(col); + assertNoProblemBindings( col ); + } + public void testBasicFunction() throws Exception { StringBuffer buff = new StringBuffer(); buff.append("int x;\n"); //$NON-NLS-1$