1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3 // FIXME: test with non-std qualifiers
7 Const(const Const
&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be const}}
8 Const
& operator=(const Const
&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be const}}
12 Volatile(volatile Volatile
&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be volatile}}
13 Volatile
& operator=(volatile Volatile
&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be volatile}}
16 struct AssignmentRet1
{
17 AssignmentRet1
&& operator=(AssignmentRet1
&&) = default; // expected-error {{explicitly-defaulted move assignment operator must return 'AssignmentRet1 &'}}
20 struct AssignmentRet2
{
21 const AssignmentRet2
& operator=(AssignmentRet2
&&) = default; // expected-error {{explicitly-defaulted move assignment operator must return 'AssignmentRet2 &'}}
24 struct ConstAssignment
{
25 ConstAssignment
& operator=(ConstAssignment
&&) const = default; // expected-error {{an explicitly-defaulted move assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
31 Volatile(const volatile Volatile
&) = default; // expected-error {{the parameter for an explicitly-defaulted copy constructor may not be volatile}}
32 Volatile
& operator=(const volatile Volatile
&) = default; // expected-error {{the parameter for an explicitly-defaulted copy assignment operator may not be volatile}}
36 Const(const Const
&) = default;
37 Const
& operator=(const Const
&) = default;
41 NonConst(NonConst
&) = default;
42 NonConst
& operator=(NonConst
&) = default;
46 NonConst2(NonConst2
&);
47 NonConst2
& operator=(NonConst2
&);
49 NonConst2::NonConst2(NonConst2
&) = default;
50 NonConst2
&NonConst2::operator=(NonConst2
&) = default;
53 NonConst3(NonConst3
&) = default;
54 NonConst3
& operator=(NonConst3
&) = default;
59 BadConst(const BadConst
&) = default; // expected-error {{is const, but}}
60 BadConst
& operator=(const BadConst
&) = default; // expected-error {{is const, but}}
61 NonConst nc
; // makes implicit copy non-const
64 struct AssignmentRet1
{
65 AssignmentRet1
&& operator=(const AssignmentRet1
&) = default; // expected-error {{explicitly-defaulted copy assignment operator must return 'AssignmentRet1 &'}}
68 struct AssignmentRet2
{
69 const AssignmentRet2
& operator=(const AssignmentRet2
&) = default; // expected-error {{explicitly-defaulted copy assignment operator must return 'AssignmentRet2 &'}}
72 struct ConstAssignment
{
73 ConstAssignment
& operator=(const ConstAssignment
&) const = default; // expected-error {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}