summaryrefslogtreecommitdiff
path: root/clang/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
blob: ee870d9601614c4a34e23b10bf9955859976d6b7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clang_cc1 -verify %s

class A {
public:
  explicit A();
  
  explicit operator int(); // expected-warning {{explicit conversion functions are a C++11 extension}}

  explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}}
  
  operator bool();
};

explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}}
explicit A::operator bool() { return false; }  // expected-warning {{explicit conversion functions are a C++11 extension}}\
                                               // expected-error {{'explicit' can only be specified inside the class definition}}