blob: e5b58899545c59298c23415fd570dd00e7807237 [file] [log] [blame]
Richard Smith7a614d82011-06-11 17:19:42 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
2
3struct NoDefault {
4 NoDefault() = delete; // expected-note {{here}}
5 NoDefault(int);
6};
7struct Explicit { // expected-note {{candidate}} expected-note {{here}}
8 explicit Explicit(int);
9};
10struct NoCopy {
11 NoCopy();
12 NoCopy(const NoCopy &) = delete; // expected-note {{here}}
13};
14struct NoMove {
15 NoMove();
16 NoMove(NoMove &&) = delete; // expected-note {{here}}
17};
18class Private {
19 Private(int); // expected-note {{here}}
20public:
21 Private();
22};
23class Friend {
24 friend class S;
25 Friend(int);
26};
27
28
29class S {
30 NoDefault nd1;
31 NoDefault nd2 = 42;
32 Explicit e1; // expected-note {{here}}
33 Explicit e2 = 42; // expected-error {{no viable conversion}}
34 NoCopy nc = NoCopy(); // expected-error {{call to deleted}}
35 NoMove nm = NoMove(); // expected-error {{call to deleted}}
36 Private p = 42; // expected-error {{private constructor}}
37 Friend f = 42;
38
39 S() {} // expected-error {{call to deleted constructor of 'NoDefault'}} \
40 expected-error {{must explicitly initialize the member 'e1' which does not have a default constructor}}
41 S(int) : nd1(42), e1(42) {}
42};
43
44// FIXME: test the other forms which use copy-initialization