| 1 |
// PR c++/94205 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
struct S |
| 5 |
{ |
| 6 |
struct A |
| 7 |
{ |
| 8 |
S *p; |
| 9 |
constexpr A(S* p): p(p) {} |
| 10 |
constexpr operator int() { p->a = 5; return 6; } |
| 11 |
}; |
| 12 |
int a = A(this); |
| 13 |
}; |
| 14 |
|
| 15 |
|
| 16 |
constexpr S s = {}; |
| 17 |
|
| 18 |
#define SA(X) static_assert((X),#X) |
| 19 |
SA(s.a == 6); |