2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / explicit2.C
blob7d1748c0f5e3def47197295cc45cb05d8edda96f
1 // P0892R2
2 // { dg-do compile }
3 // { dg-options "-std=c++2a" }
5 int foo() { return 42; }
6 int g;
8 struct S {
9   explicit(foo()) S(int); // { dg-error "call to" }
10   explicit(int) S(int, int); // { dg-error "expected" }
11   explicit(false ? 1 : throw 1) S(int, int, int); // { dg-error "not a constant" }
14 struct S2 {
15   explicit(true) S2();
16   explicit(false) S2(); // { dg-error "cannot be overloaded" }
19 int
20 main ()
22   S s1 = { 1 };
23   S s2 = { 1, 2 }; // { dg-error "could not convert" }
24   S s3 = { 1, 2, 3 };