Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/explicit8.C

raw
1 // P0892R2
2 // { dg-do compile }
3 // { dg-options "-std=c++2a" }
4
5 struct X {
6 template<typename T, int N = 1>
7 explicit(N) operator T();
8 };
9
10 int
11 main ()
12 {
13 X x;
14 int i = x; // { dg-error "cannot convert" }
15 int i2{x};
16 double d = x; // { dg-error "cannot convert" }
17 double d2{x};
18 char c = x; // { dg-error "cannot convert" }
19 char c2{x};
20 long l = x; // { dg-error "cannot convert" }
21 long l2{x};
22 int *p = x; // { dg-error "cannot convert" }
23 int *p2{x};
24 }