Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/paren-init34.C

raw
1 // PR c++/92812
2 // { dg-do compile { target c++20 } }
3 // Initializing arrays in a member init list using ()-init, invalid cases.
4
5 struct S { int x, y; };
6 struct N { int x, y; N(int, int); };
7
8 struct A {
9 N a[2];
10 A() : a(1, 2) { } // { dg-error "could not convert" }
11 };
12
13 struct B {
14 S a[2];
15 B() : a(1) // { dg-error "could not convert" }
16 { }
17 };
18
19 // Copy-initialization does not consider explicit ctors.
20 struct E { explicit E(int); };
21
22 struct C {
23 E a[2];
24 C() : a(4, 5) { } // { dg-error "could not convert" }
25 };