Daily bump.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / paren-init32.C
blobbf7833ebd5bc32fc06d040166b6721b60aebb0ff
1 // PR c++/92812
2 // P1975R0
3 // { dg-do compile { target c++20 } }
5 struct A { int i; };
6 struct A2 { int i; A2(int); };
7 struct A3 { int i; explicit A3(int); };
9 struct X { A a; };
10 auto x = static_cast<X>(42); // { dg-error "could not convert" }
12 struct X2 { A2 a; };
13 auto x2 = static_cast<X2>(42);
15 struct X3 { A3 a; };
16 // Aggregate-initialization copy-initializes, so the explicit ctor
17 // isn't considered.
18 auto x3 = static_cast<X3>(42); // { dg-error "could not convert" }
20 struct NonAggr { int i; virtual void foo (); };
21 auto x4 = static_cast<NonAggr>(42); // { dg-error "no matching" }