1 // { dg-do compile { target c++11 } }
9 explicit operator bool() const { return true; } // { dg-message "explicit conversion function was not considered" }
10 explicit operator int() const { return 42; } // { dg-message "explicit conversion function was not considered" }
11 explicit operator char() const { return 42; } // { dg-message "explicit conversion function was not considered" }
12 explicit operator double() const { return 42.; } // { dg-message "explicit conversion function was not considered" }
13 explicit operator float() const { return 42.; } // { dg-message "explicit conversion function was not considered" }
14 explicit operator long() const { return 42.; } // { dg-message "explicit conversion function was not considered" }
20 return S{2}; // { dg-error "cannot convert .S. to .double. in return" }
26 S s = {1}; // { dg-error "would use explicit constructor" }
27 bool b = S{1}; // { dg-error "cannot convert .S. to .bool. in initialization" }
29 i = S{2}; // { dg-error "cannot convert .S. to .int. in assignment" }
30 f (S{3}); // { dg-error "cannot convert .S. to .char." }
31 A a{ S{4} }; // { dg-error "cannot convert .S. to .long int. in initialization" }
32 float arr[1] = { S{5} }; // { dg-error "cannot convert .S. to .float. in initialization" }