Home | History | Annotate | Download | only in dcl.init
      1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
      2 
      3 struct NoDefault {
      4   NoDefault() = delete; // expected-note {{here}}
      5   NoDefault(int);
      6 };
      7 struct Explicit { // expected-note 2 {{candidate}} expected-note {{here}}
      8   explicit Explicit(int);
      9 };
     10 struct NoCopy {
     11   NoCopy();
     12   NoCopy(const NoCopy &) = delete; // expected-note {{here}}
     13 };
     14 struct NoMove {
     15   NoMove();
     16   NoMove(NoMove &&) = delete; // expected-note {{here}}
     17 };
     18 class Private {
     19   Private(int); // expected-note {{here}}
     20 public:
     21   Private();
     22 };
     23 class Friend {
     24   friend class S;
     25   Friend(int);
     26 };
     27 
     28 
     29 class 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
     45