diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-07 02:10:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-07 02:10:28 +0000 |
commit | 504643934a1cb2f9d0c22b4895c777d8aa4c5139 (patch) | |
tree | 8365e26770ca94118af6ae4c5421d80edc9a2983 /test/CXX/dcl.decl/dcl.fct.def | |
parent | 29f5ccd7ef9bc066cb5894834945eaad2c4c7e53 (diff) |
Per [dcl.fct.def.default]p1, don't allow variadic special members to be defaulted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169574 91177308-0d34-0410-b5e6-96231b3b80d8
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 | 26 |
1 files changed, 26 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 0000000000..e3e19e169e --- /dev/null +++ b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp @@ -0,0 +1,26 @@ +// 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; + + // FIXME: + // 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; // FIXME: expected-error {{must be defaulted outside the class}} + A &operator=(A &) = default; // FIXME: expected-error {{must be defaulted outside the class}} + + // -- 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}} +}; |