Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/explicit7.C

raw
1 // [over.match.conv]: For direct-initialization, those explicit conversion
2 // functions that are not hidden within S and yield type T or a type that
3 // can be converted to type T with a qualification conversion (4.4) are
4 // also candidate functions.
5
6 // { dg-do compile { target c++11 } }
7 // { dg-options "" }
8
9 struct A { };
10 struct B: A { };
11 struct C {
12 explicit operator B*(); // { dg-message "explicit" }
13 explicit operator B&(); // { dg-message "explicit" "" { target c++17_down } }
14 };
15
16 C c;
17 A* ap (c); // { dg-error "" }
18 A& ar (c); // { dg-error "" }