| 1 |
// PR c++/60686 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
struct A { |
| 5 |
explicit operator int() const; |
| 6 |
}; |
| 7 |
|
| 8 |
explicit inline A::operator int() const { return 1; } // { dg-error "1:'explicit' outside class declaration" } |
| 9 |
|
| 10 |
struct B { |
| 11 |
explicit void f(); // { dg-error "3:only declarations of constructors and conversion operators can be 'explicit'" } |
| 12 |
}; |
| 13 |
|
| 14 |
explicit void B::f() { } // { dg-error "1:'explicit' outside class declaration" } |
| 15 |
|
| 16 |
struct C { |
| 17 |
explicit C(int); |
| 18 |
}; |
| 19 |
|
| 20 |
struct D { |
| 21 |
explicit friend C::C(int); // { dg-error "3:'explicit' in friend declaration" } |
| 22 |
}; |