45 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s2 3struct NoDefault {4 NoDefault() = delete; // expected-note {{here}}5 NoDefault(int);6};7struct Explicit { // expected-note 2 {{candidate}} expected-note {{here}}8 explicit Explicit(int); // expected-note {{not a candidate}}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; // expected-note {{default constructed field 'nd1' declared here}}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-initialization45