Home | History | Annotate | Download | only in class.inhctor
      1 // RUN: %clang_cc1 -std=c++11 -verify %s
      2 //
      3 // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior
      4 // for the wording that used to be there.
      5 
      6 struct A { // expected-note 8{{candidate is the implicit}}
      7   A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}}
      8   A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
      9   A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
     10 
     11   template<typename T> A(T, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}}
     12 
     13   template<typename T, int N> A(const T (&)[N]); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}
     14   template<typename T, int N> A(const T (&)[N], int = 0); // expected-note {{candidate constructor}} expected-note {{candidate inherited constructor}}
     15 };
     16 
     17 struct B : A { // expected-note 4{{candidate is the implicit}}
     18   using A::A; // expected-note 19{{inherited here}}
     19   B(void*);
     20 };
     21 
     22 struct C {} c;
     23 
     24 A a0{}; // expected-error {{ambiguous}}
     25 B b0{}; // expected-error {{ambiguous}}
     26 
     27 A a1{1}; // expected-error {{ambiguous}}
     28 B b1{1}; // expected-error {{ambiguous}}
     29 
     30 A a2{1,2}; // expected-error {{ambiguous}}
     31 B b2{1,2}; // expected-error {{ambiguous}}
     32 
     33 A a3{1,2,3}; // ok
     34 B b3{1,2,3}; // ok
     35 
     36 A a4{1,2,3,4}; // ok
     37 B b4{1,2,3,4}; // ok
     38 
     39 A a5{1,2,3,4,5}; // ok
     40 B b5{1,2,3,4,5}; // ok
     41 
     42 A a6{c}; // ok
     43 B b6{c}; // ok
     44 
     45 A a7{c,0}; // ok
     46 B b7{c,0}; // ok
     47 
     48 A a8{c,0,1}; // ok
     49 B b8{c,0,1}; // ok
     50 
     51 A a9{"foo"}; // expected-error {{ambiguous}}
     52 B b9{"foo"}; // expected-error {{ambiguous}}
     53 
     54 namespace PR15755 {
     55   struct X {
     56     template<typename...Ts> X(int, Ts...);
     57   };
     58   struct Y : X {
     59     using X::X;
     60   };
     61   struct Z : Y {
     62     using Y::Y;
     63   };
     64   Z z(0);
     65 }
     66