p1.cpp revision 504643934a1cb2f9d0c22b4895c777d8aa4c5139
1// RUN: %clang_cc1 -verify %s -std=c++11 2 3// A function that is explicitly defaulted shall 4struct A { 5 // -- be a special member function, 6 A(int) = default; // expected-error {{only special member functions may be defaulted}} 7 8 // -- have the same declared function type as if it had been implicitly 9 // declared 10 void operator=(const A &) = default; // expected-error {{must return 'A &'}} 11 A(...) = default; // expected-error {{cannot be variadic}} 12 A(const A &, ...) = default; // expected-error {{cannot be variadic}} 13 14 // (except for possibly differing ref-qualifiers 15 A &operator=(A &&) & = default; 16 17 // FIXME: 18 // and except that in the case of a copy constructor or copy assignment 19 // operator, the parameter type may be "reference to non-const T") 20 A(A &) = default; // FIXME: expected-error {{must be defaulted outside the class}} 21 A &operator=(A &) = default; // FIXME: expected-error {{must be defaulted outside the class}} 22 23 // -- not have default arguments 24 A(double = 0.0) = default; // expected-error {{cannot have default arguments}} 25 A(const A & = 0) = default; // expected-error {{cannot have default arguments}} 26}; 27