summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/explicit8.C
blob: 9a8ecb348c602538a477048280a7d2cd4d0fc30c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/60686
// { dg-do compile { target c++11 } }

struct A {
  explicit operator int() const;
};

explicit inline A::operator int() const { return 1; }  // { dg-error "1:'explicit' outside class declaration" }

struct B {
  explicit void f();  // { dg-error "3:only declarations of constructors and conversion operators can be 'explicit'" }
};

explicit void B::f() { }  // { dg-error "1:'explicit' outside class declaration" }

struct C {
  explicit C(int);
};

struct D {
  explicit friend C::C(int);  // { dg-error "3:'explicit' in friend declaration" }
};