xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/dcl.decl/dcl.init/p14-0x.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct NoDefault {
4*f4a2713aSLionel Sambuc   NoDefault() = delete; // expected-note {{here}}
5*f4a2713aSLionel Sambuc   NoDefault(int);
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc struct Explicit { // expected-note 2 {{candidate}} expected-note {{here}}
8*f4a2713aSLionel Sambuc   explicit Explicit(int);
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc struct NoCopy {
11*f4a2713aSLionel Sambuc   NoCopy();
12*f4a2713aSLionel Sambuc   NoCopy(const NoCopy &) = delete; // expected-note {{here}}
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc struct NoMove {
15*f4a2713aSLionel Sambuc   NoMove();
16*f4a2713aSLionel Sambuc   NoMove(NoMove &&) = delete; // expected-note {{here}}
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc class Private {
19*f4a2713aSLionel Sambuc   Private(int); // expected-note {{here}}
20*f4a2713aSLionel Sambuc public:
21*f4a2713aSLionel Sambuc   Private();
22*f4a2713aSLionel Sambuc };
23*f4a2713aSLionel Sambuc class Friend {
24*f4a2713aSLionel Sambuc   friend class S;
25*f4a2713aSLionel Sambuc   Friend(int);
26*f4a2713aSLionel Sambuc };
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc class S {
30*f4a2713aSLionel Sambuc   NoDefault nd1;
31*f4a2713aSLionel Sambuc   NoDefault nd2 = 42;
32*f4a2713aSLionel Sambuc   Explicit e1; // expected-note {{here}}
33*f4a2713aSLionel Sambuc   Explicit e2 = 42; // expected-error {{no viable conversion}}
34*f4a2713aSLionel Sambuc   NoCopy nc = NoCopy(); // expected-error {{call to deleted}}
35*f4a2713aSLionel Sambuc   NoMove nm = NoMove(); // expected-error {{call to deleted}}
36*f4a2713aSLionel Sambuc   Private p = 42; // expected-error {{private constructor}}
37*f4a2713aSLionel Sambuc   Friend f = 42;
38*f4a2713aSLionel Sambuc 
S()39*f4a2713aSLionel Sambuc   S() {} // expected-error {{call to deleted constructor of 'NoDefault'}} \
40*f4a2713aSLionel Sambuc             expected-error {{must explicitly initialize the member 'e1' which does not have a default constructor}}
S(int)41*f4a2713aSLionel Sambuc   S(int) : nd1(42), e1(42) {}
42*f4a2713aSLionel Sambuc };
43*f4a2713aSLionel Sambuc 
44*f4a2713aSLionel Sambuc // FIXME: test the other forms which use copy-initialization
45