xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/cxx11-inheriting-ctors.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 %s -verify
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // expected-no-diagnostics
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc namespace PR15757 {
6f4a2713aSLionel Sambuc   struct S {
7f4a2713aSLionel Sambuc   };
8f4a2713aSLionel Sambuc 
9f4a2713aSLionel Sambuc   template<typename X, typename Y> struct T {
TPR15757::T10f4a2713aSLionel Sambuc     template<typename A> T(X x, A &&a) {}
11f4a2713aSLionel Sambuc 
TPR15757::T12f4a2713aSLionel Sambuc     template<typename A> explicit T(A &&a)
13f4a2713aSLionel Sambuc         noexcept(noexcept(T(X(), static_cast<A &&>(a))))
14f4a2713aSLionel Sambuc       : T(X(), static_cast<A &&>(a)) {}
15f4a2713aSLionel Sambuc   };
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc   template<typename X, typename Y> struct U : T<X, Y> {
18f4a2713aSLionel Sambuc     using T<X, Y>::T;
19f4a2713aSLionel Sambuc   };
20f4a2713aSLionel Sambuc 
foo(char ch)21f4a2713aSLionel Sambuc   U<S, char> foo(char ch) { return U<S, char>(ch); }
22f4a2713aSLionel Sambuc 
main()23f4a2713aSLionel Sambuc   int main() {
24f4a2713aSLionel Sambuc     U<S, int> a(42);
25f4a2713aSLionel Sambuc     U<S, char> b('4');
26f4a2713aSLionel Sambuc     return 0;
27f4a2713aSLionel Sambuc   }
28f4a2713aSLionel Sambuc }
29*0a6a1f1dSLionel Sambuc 
30*0a6a1f1dSLionel Sambuc namespace WrongIdent {
31*0a6a1f1dSLionel Sambuc   struct A {};
32*0a6a1f1dSLionel Sambuc   struct B : A {};
33*0a6a1f1dSLionel Sambuc   struct C : B {
34*0a6a1f1dSLionel Sambuc     using B::A;
35*0a6a1f1dSLionel Sambuc   };
36*0a6a1f1dSLionel Sambuc }
37