1 // RUN: %clang_cc1 -verify %s
2 // RUN: %clang_cc1 -verify -std=c++98 %s
3 // RUN: %clang_cc1 -verify -std=c++11 %s
4 
5 class A {
6 public:
7   explicit A();
8 
9   explicit operator int();
10 #if __cplusplus <= 199711L // C++03 or earlier modes
11   // expected-warning@-2 {{explicit conversion functions are a C++11 extension}}
12 #endif
13 
14   explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}}
15 
16   operator bool();
17 };
18 
A()19 explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}}
operator bool()20 explicit A::operator bool() { return false; }
21 #if __cplusplus <= 199711L // C++03 or earlier modes
22 // expected-warning@-2 {{explicit conversion functions are a C++11 extension}}
23 #endif
24 // expected-error@-4 {{'explicit' can only be specified inside the class definition}}
25 
26 class B {
27   friend explicit A::A(); // expected-error {{'explicit' is invalid in friend declarations}}
28 };
29