summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/cxx11-inheriting-ctors.cpp')
-rw-r--r--clang/test/SemaCXX/cxx11-inheriting-ctors.cpp32
1 files changed, 30 insertions, 2 deletions
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}}
+}
OpenPOWER on IntegriCloud