| 1 |
// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
struct A { |
| 5 |
A(); |
| 6 |
A(const A(&)[2]); |
| 7 |
}; |
| 8 |
|
| 9 |
using T = A[]; |
| 10 |
using U = A[2]; |
| 11 |
|
| 12 |
// t binds directly to U{} now. Before it bound indirectly to a temporary |
| 13 |
// A{U{}}. ??? But we don't do it now; see reference_binding and the |
| 14 |
// BRACE_ENCLOSED_INITIALIZER_P block. |
| 15 |
A (&&t)[] = {U{}}; |
| 16 |
|
| 17 |
U u{}; |
| 18 |
|
| 19 |
T & |
| 20 |
foo () |
| 21 |
{ |
| 22 |
// This didn't compile before P0388R4: invalid initialization of non-const |
| 23 |
// reference of type 'A (&)[]' from an rvalue of type |
| 24 |
// '<brace-enclosed initializer list>'. |
| 25 |
return {u}; |
| 26 |
} |