Home | History | Annotate | Download | only in class.inhctor
      1 // RUN: %clang_cc1 -std=c++11 -verify %s
      2 
      3 struct A {
      4   constexpr A(const int&) : rval(false) {}
      5   constexpr A(const int&&) : rval(true) {}
      6   bool rval;
      7 };
      8 struct B : A {
      9   using A::A;
     10 };
     11 
     12 constexpr int k = 0;
     13 constexpr A a0{0};
     14 constexpr A a1{k};
     15 constexpr B b0{0};
     16 // This performs static_cast<(const int&)&&>(k), so calls the A(const int&)
     17 // constructor.
     18 constexpr B b1{k};
     19 
     20 static_assert(a0.rval && !a1.rval && b0.rval && !b1.rval, "");
     21 
     22 struct C {
     23   template<typename T> constexpr C(T t) : v(t) {}
     24   int v;
     25 };
     26 struct D : C {
     27   using C::C;
     28 };
     29 static_assert(D(123).v == 123, "");
     30 
     31 // FIXME: This diagnostic sucks.
     32 template<typename T> constexpr D::D(T t) : C(t) {} // expected-error {{definition of implicitly declared function}}
     33