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 f75107f7747..66d26cb19d1 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 @@ -121,10 +121,8 @@ import org.eclipse.cdt.internal.core.parser.ParserException; /** * @author aniefer */ - public class AST2CPPTests extends AST2BaseTest { - public AST2CPPTests() { } @@ -6120,4 +6118,38 @@ public class AST2CPPTests extends AST2BaseTest { assertEquals(1, ors.length); assertSame(ors[0], m1); } + + // void f(...); + // + // void test(int* p) { + // f(p); + // } + public void _testVariadicFunction_2500582() throws Exception { + final String comment= getAboveComment(); + final boolean[] isCpps= {false, true}; + for (boolean isCpp : isCpps) { + BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); + ba.assertNonProblem("f(p)", 1, IFunction.class); + } + } + + // struct Incomplete; + // + // void f(Incomplete* p); + // void f(...); + // + // void test() { + // // Should resolve to f(Incomplete*) since 0 can be converted to Incomplete* + // f(0); + // } + public void _testVariadicFunction_2500583() throws Exception { + final String comment= getAboveComment(); + final boolean[] isCpps= {false, true}; + for (boolean isCpp : isCpps) { + BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); + IFunction decl= ba.assertNonProblem("f(Incomplete* p)", 1, IFunction.class); + IFunction func= ba.assertNonProblem("f(0)", 1, IFunction.class); + assertSame(decl, func); + } + } } 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 8308bfb33c7..eaab8a61819 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 @@ -4931,7 +4931,7 @@ public class AST2Tests extends AST2BaseTest { assertEquals(2, tu.getDeclarationsInAST(binding).length); } } - + // void f() { // int a,b; // { b; a; int a; } @@ -4940,7 +4940,7 @@ public class AST2Tests extends AST2BaseTest { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (boolean isCpp : isCpps) { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp); + BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); ba.assertNonProblem("b; a", 1, IVariable.class); // fill cache of inner block IVariable v3= ba.assertNonProblem("a; }", 1, IVariable.class); @@ -4956,7 +4956,7 @@ public class AST2Tests extends AST2BaseTest { final String comment= getAboveComment(); final boolean[] isCpps= {false, true}; for (boolean isCpp : isCpps) { - BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), isCpp); + BindingAssertionHelper ba= new BindingAssertionHelper(comment, isCpp); IParameter p= ba.assertNonProblem("ptr", 3, IParameter.class); assertEquals("ptr", p.getName()); }