| 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 { |
| 7 |
constexpr A(const int&) : rval(false) {} |
| 8 |
constexpr A(const int&&) : rval(true) {} |
| 9 |
bool rval; |
| 10 |
}; |
| 11 |
struct B : A { |
| 12 |
using A::A; |
| 13 |
}; |
| 14 |
|
| 15 |
constexpr int k = 0; |
| 16 |
constexpr A a0{0}; |
| 17 |
constexpr A a1{k}; |
| 18 |
constexpr B b0{0}; |
| 19 |
constexpr B b1{k}; |
| 20 |
|
| 21 |
static_assert(a0.rval && !a1.rval && b0.rval && !b1.rval, ""); |
| 22 |
|
| 23 |
struct C { |
| 24 |
template<typename T> constexpr C(T t) : v(t) {} |
| 25 |
int v; |
| 26 |
}; |
| 27 |
struct D : C { // #defined-here |
| 28 |
using C::C; |
| 29 |
}; |
| 30 |
static_assert(D(123).v == 123, ""); |
| 31 |
|
| 32 |
template<typename T> constexpr D::D(T t) : C(t) {} // expected-error {{does not match any declaration in 'D'}} |
| 33 |
// expected-note@#defined-here {{defined here}} |