diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/cpp2a/array-conv2.C	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,26 @@
+// PR c++/91364 - Implement P0388R4: Permit conversions to arrays of unknown bound.
+// { dg-do compile { target c++2a } }
+
+struct A {
+  A();
+  A(const A(&)[2]);
+};
+
+using T = A[];
+using U = A[2];
+
+// t binds directly to U{} now.  Before it bound indirectly to a temporary
+// A{U{}}.  ??? But we don't do it now; see reference_binding and the 
+// BRACE_ENCLOSED_INITIALIZER_P block.
+A (&&t)[] = {U{}};
+
+U u{};
+
+T &
+foo ()
+{
+  // This didn't compile before P0388R4: invalid initialization of non-const
+  // reference of type 'A (&)[]' from an rvalue of type
+  // '<brace-enclosed initializer list>'.
+  return {u};
+}