| 1 |
// P0892R2 |
| 2 |
// { dg-do compile } |
| 3 |
// Explicit { dg-require-effective-target exceptions_enabled } to avoid verify compiler messages FAILs for '-fno-exceptions'. |
| 4 |
// { dg-options "-std=c++2a" } |
| 5 |
|
| 6 |
int foo() { return 42; } |
| 7 |
int g; |
| 8 |
|
| 9 |
struct S { |
| 10 |
explicit(foo()) S(int); // { dg-error "call to" } |
| 11 |
explicit(int) S(int, int); // { dg-error "expected" } |
| 12 |
explicit(false ? 1 : throw 1) S(int, int, int); // { dg-error "not a constant" } |
| 13 |
}; |
| 14 |
|
| 15 |
struct S2 { |
| 16 |
explicit(true) S2(); |
| 17 |
explicit(false) S2(); // { dg-error "cannot be overloaded" } |
| 18 |
}; |
| 19 |
|
| 20 |
int |
| 21 |
main () |
| 22 |
{ |
| 23 |
S s1 = { 1 }; |
| 24 |
S s2 = { 1, 2 }; // { dg-error "could not convert" } |
| 25 |
S s3 = { 1, 2, 3 }; |
| 26 |
} |