| 1 |
// PR c++/103879 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
struct A { int n = 42; }; |
| 5 |
struct B : A { }; |
| 6 |
struct C { B b; }; |
| 7 |
|
| 8 |
constexpr int f() { |
| 9 |
C c; |
| 10 |
A& a = static_cast<A&>(c.b); |
| 11 |
B& b = static_cast<B&>(a); |
| 12 |
return b.n; |
| 13 |
} |
| 14 |
|
| 15 |
static_assert(f() == 42, ""); |