| 1 |
// PR c++/85437 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct A { int a; constexpr A() : a(0) {} }; |
| 5 |
struct B : A { int x; constexpr B() : x(0) {} }; |
| 6 |
struct X { int z; constexpr X() : z(0) {} }; |
| 7 |
struct C : X, B {}; |
| 8 |
constexpr int C::*cbx = &B::x; |
| 9 |
constexpr int B::*bx = &B::x; |
| 10 |
constexpr int A::*abx = static_cast<int(A::*)>(&B::x); // { dg-bogus "not a constant expression" } |
| 11 |
|
| 12 |
constexpr const C y; |
| 13 |
constexpr const B& yb = y; |
| 14 |
constexpr const A& ya = y; |
| 15 |
constexpr int const *pcbx = &(y.*cbx); |
| 16 |
constexpr int const *pbx = &(y.*bx); |
| 17 |
constexpr int const *pabx = &(ya.*abx); |