array = build_array_of_n_type (elttype, len);
array = finish_compound_literal (array, new_ctor, complain);
/* This is dubious now, should be blessed by P2752. */
--- gcc/testsuite/g++.dg/cpp/embed-15.C.jj 2024-12-19 15:07:28.564605983
+0100
+++ gcc/testsuite/g++.dg/cpp/embed-15.C 2024-12-19 15:08:14.194998077 +0100
@@ -0,0 +1,35 @@
+// PR c++/118124
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+namespace std {
+template <class T> struct initializer_list {
+private:
+ const T *_M_array;
+ __SIZE_TYPE__ _M_len;
+};
+}
+struct A {
+ A (std::initializer_list<char>);
+};
+A a {
+#embed __FILE__
+};
+struct B {
+ B (std::initializer_list<unsigned char>);
+};
+B b {
+#embed __FILE__
+};
+struct C {
+ C (std::initializer_list<int>);
+};
+C c {
+#embed __FILE__
+};
+struct D {
+ D (std::initializer_list<float>);
+};
+D d {
+#embed __FILE__
+};
--- gcc/testsuite/g++.dg/cpp/embed-16.C.jj 2024-12-19 15:09:20.929109016
+0100
+++ gcc/testsuite/g++.dg/cpp/embed-16.C 2024-12-19 15:11:12.811618467 +0100
@@ -0,0 +1,18 @@
+// PR c++/118124
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+// non-ASCII chars here: áéí
+
+namespace std {
+template <class T> struct initializer_list {
+private:
+ const T *_M_array;
+ __SIZE_TYPE__ _M_len;
+};
+}
+struct A {
+ A (std::initializer_list<signed char>);
+};
+A a {
+#embed __FILE__
+}; // { dg-error "narrowing conversion of '\[0-9]*' from 'int' to 'signed
char'" }
--- gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C.jj 2024-12-19
14:52:17.389013179 +0100
+++ gcc/testsuite/g++.dg/cpp0x/initlist-opt3.C 2024-12-19 15:06:28.652404163
+0100
@@ -0,0 +1,47 @@
+// PR c++/118124
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+namespace std {
+template <class T> struct initializer_list {
+private:
+ const T *_M_array;
+ __SIZE_TYPE__ _M_len;
+};
+}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4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
+struct D {
+ D (std::initializer_list<float>);
+};
+D d { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 };
--- gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C.jj 2024-12-19
14:52:46.517612306 +0100
+++ gcc/testsuite/g++.dg/cpp0x/initlist-opt4.C 2024-12-19 15:06:52.513086275
+0100
@@ -0,0 +1,20 @@
+// PR c++/118124
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2" }
+
+namespace std {
+template <class T> struct initializer_list {
+private:
+ const T *_M_array;
+ __SIZE_TYPE__ _M_len;
+};
+}
+struct A {
+ A (std::initializer_list<signed char>);
+};
+A a { 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1,
+ 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 209, 0, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; // { dg-error
"narrowing conversion of '209' from 'int' to 'signed char'" }
Jakub