comparison gcc/testsuite/g++.dg/cpp2a/array-conv2.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
2 // { dg-do compile { target c++2a } }
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 }