1 // { dg-do assemble } 2 3 class string { 4 public: string(const char *)5 string(const char*) { } string(int size)6 explicit string(int size) { } 7 }; 8 foo(string)9void foo(string) { } 10 bar()11string bar() { 12 foo("hello"); // ok 13 foo(string(2)); // ok 14 foo(2); // { dg-error "" } no implicit conversion from int to string 15 string x = 2; // { dg-error "" } no implicit conversion from int to string 16 string y(2); // ok 17 foo((string)2); // ok 18 return 2; // { dg-error "" } no implicit conversion from int to string 19 } 20 21 class A : string { 22 public: A()23 A() : string(2) { } // ok 24 }; 25