diff options
Diffstat (limited to 'test/SemaCXX/cxx11-inheriting-ctors.cpp')
-rw-r--r-- | test/SemaCXX/cxx11-inheriting-ctors.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx11-inheriting-ctors.cpp b/test/SemaCXX/cxx11-inheriting-ctors.cpp index 04aa117b29dd..9c33ac05cc5f 100644 --- a/test/SemaCXX/cxx11-inheriting-ctors.cpp +++ b/test/SemaCXX/cxx11-inheriting-ctors.cpp @@ -34,3 +34,25 @@ namespace WrongIdent { using B::A; }; } + +namespace DefaultCtorConflict { + struct A { A(int = 0); }; + struct B : A { + using A::A; + } b; // ok, not ambiguous, inherited constructor suppresses implicit default constructor + struct C { + B b; + } c; +} + +namespace InvalidConstruction { + struct A { A(int); }; + struct B { B() = delete; }; + struct C : A, B { using A::A; }; + // Initialization here is performed as if by a defaulted default constructor, + // which would be ill-formed (in the immediate context) in this case because + // it would be defined as deleted. + template<typename T> void f(decltype(T(0))*); + template<typename T> int &f(...); + int &r = f<C>(0); +} |