diff options
Diffstat (limited to 'test/CXX/dcl.decl/dcl.fct.def')
-rw-r--r-- | test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp new file mode 100644 index 000000000000..51993307cfff --- /dev/null +++ b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -verify %s -std=c++11 + +// A function that is explicitly defaulted shall +struct A { + // -- be a special member function, + A(int) = default; // expected-error {{only special member functions may be defaulted}} + + // -- have the same declared function type as if it had been implicitly + // declared + void operator=(const A &) = default; // expected-error {{must return 'A &'}} + A(...) = default; // expected-error {{cannot be variadic}} + A(const A &, ...) = default; // expected-error {{cannot be variadic}} + + // (except for possibly differing ref-qualifiers + A &operator=(A &&) & = default; + + // and except that in the case of a copy constructor or copy assignment + // operator, the parameter type may be "reference to non-const T") + A(A &) = default; + A &operator=(A &) = default; + + // -- not have default arguments + A(double = 0.0) = default; // expected-error {{cannot have default arguments}} + A(const A & = 0) = default; // expected-error {{cannot have default arguments}} +}; |