aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/explicit8.C
blob: bf2f9ed99177130530b6de8af5a87be051a759bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// P0892R2
// { dg-do compile }
// { dg-options "-std=c++2a" }

struct X {
  template<typename T, int N = 1>
  explicit(N) operator T();
};

int
main ()
{
  X x;
  int i = x; // { dg-error "cannot convert" }
  int i2{x};
  double d = x; // { dg-error "cannot convert" }
  double d2{x};
  char c = x; // { dg-error "cannot convert" }
  char c2{x};
  long l = x; // { dg-error "cannot convert" }
  long l2{x};
  int *p = x; // { dg-error "cannot convert" }
  int *p2{x};
}