Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2008-03-12 17:20:27 +0000
committerAndrew Ferguson2008-03-12 17:20:27 +0000
commit9a46b41c3bff62dad27a85856304377cbaab77bd (patch)
tree8a0a98c891b26ad67032585959bccf9d50854d5f
parent6d19eaab8bc0b43488ae773edbf295a06ab95e4d (diff)
downloadorg.eclipse.cdt-9a46b41c3bff62dad27a85856304377cbaab77bd.tar.gz
org.eclipse.cdt-9a46b41c3bff62dad27a85856304377cbaab77bd.tar.xz
org.eclipse.cdt-9a46b41c3bff62dad27a85856304377cbaab77bd.zip
222444: add tests
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java92
1 files changed, 91 insertions, 1 deletions
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 4d5b7d87256..98b2ac88d69 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
@@ -4327,7 +4327,7 @@ public class AST2Tests extends AST2BaseTest {
ba.assertProblem("fa(5", 2);
ICPPFunction fb= ba.assertNonProblem("fb(5", 2, ICPPFunction.class);
ba.assertProblem("fc(5", 2);
- ba.assertNonProblem("fd(5 v",2);
+ ba.assertProblem("fd(5",2);
assertEquals(ASTTypeUtil.getParameterTypeString(fb.getType()), "(const int &)");
}
@@ -4349,4 +4349,94 @@ public class AST2Tests extends AST2BaseTest {
ba.assertNonProblem("f_const(2", 6, ICPPFunction.class);
ba.assertProblem("f_nonconst(2", 9);
}
+
+ // class B {};
+ //
+ // class C {
+ // public:
+ // operator const B() const { return *new B();}
+ // };
+ //
+ // void foo(B b) {}
+ //
+ // int refs() {
+ // const C c= *new C();
+ // const B b= *new B();
+ //
+ // foo(b);
+ // foo(c);
+ // }
+ public void _testBug222444_a() throws Exception {
+ BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
+ ICPPFunction foo1= ba.assertNonProblem("foo(b", 3, ICPPFunction.class);
+ ICPPFunction foo2= ba.assertNonProblem("foo(c", 3, ICPPFunction.class);
+ }
+
+ // class B {};
+ //
+ // class A {
+ // public:
+ // A() {}
+ // A(const A&) {}
+ // A(int i) {}
+ // A(B b, int i=5) {}
+ // };
+ //
+ // class C {
+ // public:
+ // C() {}
+ // operator A&() {return *new A();}
+ // };
+ //
+ // class D {
+ // public:
+ // D() {}
+ // operator A() {return *new A();}
+ // };
+ //
+ //
+ // void foo1(A a) {}
+ // void foo2(A& a) {}
+ //
+ // int refs() {
+ // A a;
+ // B b;
+ // C c;
+ // D d;
+ //
+ // foo1(a);
+ // foo2(a); // not copied
+ //
+ // foo1(3);
+ // foo2(4); // should be an error (222418)
+ //
+ // foo2(A(5)); // should be an error (222418)
+ // foo2(A(6)); // should be an error (222418)
+ //
+ // foo1(c);
+ // foo2(c);
+ //
+ // foo1(d);
+ // foo2(d); // should be an error
+ //
+ // foo1(b);
+ // foo2(b); // should be an error
+ //
+ // return 0;
+ // }
+ public void _testBug222444_b() throws Exception {
+ BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
+ ba.assertNonProblem("foo1(a)", 4);
+ ba.assertNonProblem("foo2(a)", 4);
+ ba.assertNonProblem("foo1(3)", 4);
+ ba.assertProblem("foo2(4)", 4);
+ ba.assertProblem("foo1(A", 4);
+ ba.assertProblem("foo2(A", 4);
+ ba.assertNonProblem("foo1(c)", 4);
+ ba.assertNonProblem("foo2(c)", 4);
+ ba.assertNonProblem("foo1(d)", 4);
+ ba.assertProblem("foo2(d)", 4);
+ ba.assertNonProblem("foo1(b)", 4);
+ ba.assertProblem("foo2(b)", 4);
+ }
} \ No newline at end of file

Back to the top