2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / explicit13.C
blob4747ebd3df4a3cd81f0d9a2acdfecf730bd9ea4f
1 // P0892R2
2 // { dg-do compile }
3 // { dg-options "-std=c++2a" }
5 template<int M = 0> struct A {
6   template<typename T, int N = 0>
7   explicit(N + M) operator T();
8 };
10 template<int M = 1> struct B {
11   template<typename T, int N = 1>
12   explicit(N * M) operator T();
15 void
16 bar ()
18   A a;
19   int i = a;
21   A<0> a0;
22   int i0 = a0;
24   A<1> a1;
25   int i1 = a1; // { dg-error "cannot convert" }
27   B b;
28   int j = b; // { dg-error "cannot convert" }
30   B<0> b0;
31   int j0 = b0;
33   B<1> b1;
34   int j1 = b1; // { dg-error "cannot convert" }