diff options
Diffstat (limited to 'clang/test/SemaCXX')
| -rw-r--r-- | clang/test/SemaCXX/conditional-expr.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/copy-initialization.cpp | 11 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx0x-initializer-constructor.cpp | 5 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx11-inheriting-ctors.cpp | 32 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx98-compat-flags.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx98-compat-pedantic.cpp | 2 |
6 files changed, 47 insertions, 7 deletions
diff --git a/clang/test/SemaCXX/conditional-expr.cpp b/clang/test/SemaCXX/conditional-expr.cpp index c12efc0be7e..5025990cfd3 100644 --- a/clang/test/SemaCXX/conditional-expr.cpp +++ b/clang/test/SemaCXX/conditional-expr.cpp @@ -262,7 +262,7 @@ namespace PR6757 { struct Foo2 { }; struct Foo3 { - Foo3(); + Foo3(); // expected-note{{requires 0 arguments}} Foo3(Foo3&); // expected-note{{would lose const qualifier}} }; diff --git a/clang/test/SemaCXX/copy-initialization.cpp b/clang/test/SemaCXX/copy-initialization.cpp index d219ee508f0..4f6c65cf550 100644 --- a/clang/test/SemaCXX/copy-initialization.cpp +++ b/clang/test/SemaCXX/copy-initialization.cpp @@ -30,7 +30,7 @@ void test(const foo *P) { P->bar(); } // expected-error{{'bar' not viable: 'this namespace PR6757 { struct Foo { - Foo(); + Foo(); // expected-note{{not viable}} Foo(Foo&); // expected-note{{candidate constructor not viable}} }; @@ -71,3 +71,12 @@ namespace DR5 { const S b = 0; } } + +struct A {}; +struct B : A { + B(); + B(B&); + B(A); + B(int); +}; +B b = 0; // ok, calls B(int) then A(const A&) then B(A). diff --git a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp index 6202bf620fe..c10bee917ac 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp @@ -267,8 +267,11 @@ namespace PR12120 { struct A { explicit A(int); A(float); }; // expected-note {{declared here}} A a = { 0 }; // expected-error {{constructor is explicit}} - struct B { explicit B(short); B(long); }; // expected-note 2 {{candidate}} + struct B { explicit B(short); B(long); }; // expected-note 4{{candidate}} B b = { 0 }; // expected-error {{ambiguous}} + + struct C { explicit C(short); C(long); }; // expected-note 2{{candidate}} + C c = {{ 0 }}; // expected-error {{ambiguous}} } namespace PR12498 { diff --git a/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp b/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp index 9c33ac05cc5..5ce8d1aa3e0 100644 --- a/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp +++ b/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp @@ -1,7 +1,5 @@ // RUN: %clang_cc1 -std=c++11 %s -verify -// expected-no-diagnostics - namespace PR15757 { struct S { }; @@ -56,3 +54,33 @@ namespace InvalidConstruction { template<typename T> int &f(...); int &r = f<C>(0); } + +namespace ExplicitConv { + struct B {}; // expected-note 2{{candidate}} + struct D : B { // expected-note 3{{candidate}} + using B::B; // expected-note 2{{inherited}} + }; + struct X { explicit operator B(); } x; + struct Y { explicit operator D(); } y; + + D dx(x); // expected-error {{no matching constructor}} + D dy(y); +} + +namespace NestedListInit { + struct B { B(); } b; // expected-note 5{{candidate}} + struct D : B { // expected-note 3{{candidate}} + using B::B; // expected-note 2{{inherited}} + }; + // This is a bit weird. We're allowed one pair of braces for overload + // resolution, and one more pair of braces due to [over.ics.list]/2. + B b1 = {b}; + B b2 = {{b}}; + B b3 = {{{b}}}; // expected-error {{no match}} + // This is the same, but we get one call to D's version of B::B(const B&) + // before the two permitted calls to D::D(D&&). + D d1 = {b}; + D d2 = {{b}}; + D d3 = {{{b}}}; + D d4 = {{{{b}}}}; // expected-error {{no match}} +} diff --git a/clang/test/SemaCXX/cxx98-compat-flags.cpp b/clang/test/SemaCXX/cxx98-compat-flags.cpp index f90ad345e97..62d687c49cf 100644 --- a/clang/test/SemaCXX/cxx98-compat-flags.cpp +++ b/clang/test/SemaCXX/cxx98-compat-flags.cpp @@ -16,7 +16,7 @@ namespace CopyCtorIssues { Private(const Private&); // expected-note {{declared private here}} }; struct NoViable { - NoViable(); + NoViable(); // expected-note {{not viable}} NoViable(NoViable&); // expected-note {{not viable}} }; struct Ambiguous { diff --git a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp index 8b0dcc87132..c72c44ad5fe 100644 --- a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp +++ b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp @@ -55,7 +55,7 @@ namespace CopyCtorIssues { Private(const Private&); // expected-note {{declared private here}} }; struct NoViable { - NoViable(); + NoViable(); // expected-note {{not viable}} NoViable(NoViable&); // expected-note {{not viable}} }; struct Ambiguous { |

