blob: 26d82fe673e4150faa26914382639e25f7b0c4c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// PR c++/92134 - constinit malfunction in static data member.
// { dg-do compile { target c++20 } }
struct Value {
Value() : v{new int{42}} {}
int* v;
};
struct S {
static constinit inline Value v{}; // { dg-error "variable .S::v. does not have a constant initializer|call to non-.constexpr. function" }
// { dg-error "result of 'operator new'" "" { target implicit_constexpr } .-1 }
};
int main() { return *S::v.v; }
|