Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Vogt2018-12-05 16:54:33 -0500
committerNathan Ridge2018-12-15 02:12:33 -0500
commit945e48a40cf61e483e2c99d147bdec1c4664147b (patch)
tree97ecc6e0de6216f6c6bb31229a9b541e30fd03a8 /core/org.eclipse.cdt.core.tests
parenteb83237dc40d38a322be4e29859f47d3dd975b36 (diff)
downloadorg.eclipse.cdt-945e48a40cf61e483e2c99d147bdec1c4664147b.tar.gz
org.eclipse.cdt-945e48a40cf61e483e2c99d147bdec1c4664147b.tar.xz
org.eclipse.cdt-945e48a40cf61e483e2c99d147bdec1c4664147b.zip
Bug 542448 - Return ProblemBindings in list initialization
- Return ProblemBinding if conversion from init list failed - In conversion: don't allow implicit conversion with explicit ctor Change-Id: I3145b89df778a035ced9999aff4d8a4164eac17f Signed-off-by: Hannes Vogt <hannes@havogt.de>
Diffstat (limited to 'core/org.eclipse.cdt.core.tests')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java63
1 files changed, 60 insertions, 3 deletions
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 d1ee11ec350..3134508e077 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
@@ -148,6 +148,7 @@ import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPClassType;
+import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPConstructor;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPMethod;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPPointerType;
@@ -4225,13 +4226,15 @@ public class AST2CPPTests extends AST2CPPTestBase {
}
// class X {
- // X(const X &);
+ // public:
+ // X(const X &);
// };
// class Y {
- // operator X ();
+ // public:
+ // operator X();
// };
// Y y;
- // X x = new X(y);
+ // X* x = new X(y);
public void testBug90654a() throws Exception {
IASTTranslationUnit tu = parse(getAboveComment(), CPP);
NameCollector col = new NameCollector(true);
@@ -12777,4 +12780,58 @@ public class AST2CPPTests extends AST2CPPTestBase {
public void testElabSpecInTrailingReturn_535777() throws Exception {
parseAndCheckBindings();
}
+
+ // struct type {
+ // type(int,int){};
+ // };
+ //
+ // int main() {
+ // type a0(1,2);
+ // type a1{1,2};
+ // type a2 = {1,2};
+ // type a3(1,2,3);
+ // type a4{1,2,3};
+ // type a5 = {1,2,3};
+ // }
+ public void testInitListConstructor_542448() throws Exception {
+ BindingAssertionHelper bh = getAssertionHelper();
+ bh.assertImplicitName("a0", 2, CPPConstructor.class);
+ bh.assertImplicitName("a1", 2, CPPConstructor.class);
+ bh.assertImplicitName("a2", 2, CPPConstructor.class);
+
+ bh.assertImplicitName("a3", 2, IProblemBinding.class);
+ bh.assertImplicitName("a4", 2, IProblemBinding.class);
+ bh.assertImplicitName("a5", 2, IProblemBinding.class);
+ }
+
+ // struct type {
+ // explicit type(int,int){};
+ // };
+ //
+ // int main() {
+ // type a0(1,2); // ok
+ // type a1{1,2}; // ok
+ // type a2 = {1,2}; // error: using explict ctor
+ // }
+ public void testInitListConstructorWithExplicit_542448() throws Exception {
+ BindingAssertionHelper bh = getAssertionHelper();
+ bh.assertImplicitName("a0", 2, CPPConstructor.class);
+ bh.assertImplicitName("a1", 2, CPPConstructor.class);
+ bh.assertImplicitName("a2", 2, IProblemBinding.class);
+ }
+
+ // struct type {
+ // explicit type(int,int);
+ // type(float,float);
+ // };
+ // int main() {
+ // type a0 = {1,2};
+ // }
+ public void testInitListConstructorWithExplicit2_542448() throws Exception {
+ BindingAssertionHelper bh = getAssertionHelper();
+ // ill-formed, because overload resolution
+ // prefers the (int,int) constructor
+ // which is explicit
+ bh.assertImplicitName("a0", 2, IProblemBinding.class);
+ }
}

Back to the top