| 1 |
// PR c++/121445 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
|
| 4 |
struct D { |
| 5 |
const char *d; |
| 6 |
const char *foo () { return ""; }; // { dg-message "declared here" "" { target c++20_down } } |
| 7 |
constexpr D () : d (foo ()) {} // { dg-error "call to non-'constexpr' function 'const char\\\* D::foo\\\(\\\)'" "" { target c++20_down } } |
| 8 |
constexpr D &operator= (const char *) { return *this; } |
| 9 |
}; |
| 10 |
struct S { |
| 11 |
constexpr S () |
| 12 |
{ |
| 13 |
struct A { D a; }; |
| 14 |
struct B { A b; }; |
| 15 |
struct C { B c; }; |
| 16 |
C d {}; |
| 17 |
d.c.b.a = ""; |
| 18 |
} |
| 19 |
}; |