blob: 8e635de4514bf11ed7b8cd50a259afbb9a8925d2 [file] [log] [blame]
// PR c++/91363 - P0960R3: Parenthesized initialization of aggregates.
// { dg-do compile { target c++20 } }
// Test from [dcl.init].
struct A {
int a;
int&& r;
};
int f();
int n = 10;
A a1{1, f()}; // OK, lifetime is extended
A a2(1, f()); // well-formed, but dangling reference
A a3{1.0, 1}; // { dg-error "narrowing conversion" }
A a4(1.0, 1); // well-formed, but dangling reference
A a5(1.0, static_cast<int&&>(n)); // OK