| 1 |
// PR c++/77598 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <typename T> |
| 5 |
struct A { static constexpr T a = T (); }; |
| 6 |
template <typename T> |
| 7 |
constexpr T A<T>::a; |
| 8 |
struct B |
| 9 |
{ |
| 10 |
int b; |
| 11 |
constexpr int foo () const { return b; } |
| 12 |
constexpr B (const int &x) : b(x) {}; |
| 13 |
}; |
| 14 |
struct C : public B |
| 15 |
{ |
| 16 |
constexpr C () : B(50) {}; |
| 17 |
}; |
| 18 |
struct D : public C |
| 19 |
{ |
| 20 |
}; |
| 21 |
struct E |
| 22 |
{ |
| 23 |
static constexpr const auto &e = A<D>::a; |
| 24 |
}; |
| 25 |
constexpr const B &f = E::e; |
| 26 |
constexpr const int g = f.foo (); |