aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/special
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/special')
-rw-r--r--test/CXX/special/class.copy/implicit-move-def.cpp116
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp164
-rw-r--r--test/CXX/special/class.copy/p11.0x.copy.cpp90
-rw-r--r--test/CXX/special/class.copy/p11.0x.move.cpp85
-rw-r--r--test/CXX/special/class.copy/p15-0x.cpp18
-rw-r--r--test/CXX/special/class.copy/p33-0x.cpp2
-rw-r--r--test/CXX/special/class.ctor/p4-0x.cpp2
-rw-r--r--test/CXX/special/class.ctor/p5-0x.cpp6
-rw-r--r--test/CXX/special/class.dtor/p2-0x.cpp2
-rw-r--r--test/CXX/special/class.dtor/p3-0x.cpp2
-rw-r--r--test/CXX/special/class.inhctor/elsewhere.cpp2
-rw-r--r--test/CXX/special/class.inhctor/p3.cpp6
-rw-r--r--test/CXX/special/class.inhctor/p7.cpp2
-rw-r--r--test/CXX/special/class.init/class.base.init/p8-0x.cpp40
-rw-r--r--test/CXX/special/class.init/class.base.init/p9-0x.cpp2
-rw-r--r--test/CXX/special/class.temporary/p1.cpp58
16 files changed, 580 insertions, 17 deletions
diff --git a/test/CXX/special/class.copy/implicit-move-def.cpp b/test/CXX/special/class.copy/implicit-move-def.cpp
new file mode 100644
index 000000000000..94023cbc1d7b
--- /dev/null
+++ b/test/CXX/special/class.copy/implicit-move-def.cpp
@@ -0,0 +1,116 @@
+// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-ASSIGN %s
+// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-CTOR %s
+
+// construct
+
+struct E {
+ E();
+ E(E&&);
+};
+
+struct F {
+ F();
+ F(F&&);
+};
+
+struct G {
+ E e;
+};
+
+struct H : G {
+ F l;
+ E m;
+ F ar[2];
+};
+
+void f() {
+ H s;
+ // CHECK: call void @_ZN1HC1EOS_
+ H t(static_cast<H&&>(s));
+}
+
+
+// assign
+
+struct A {
+ A &operator =(A&&);
+};
+
+struct B {
+ B &operator =(B&&);
+};
+
+struct C {
+ A a;
+};
+
+struct D : C {
+ A a;
+ B b;
+ A ar[2];
+};
+
+void g() {
+ D d;
+ // CHECK: call {{.*}} @_ZN1DaSEOS_
+ d = D();
+}
+
+// PR10822
+struct I {
+ unsigned var[1];
+};
+
+// CHECK: define void @_Z1hv() nounwind {
+void h() {
+ I i;
+ // CHECK: call void @llvm.memcpy.
+ i = I();
+ // CHECK-NEXT: ret void
+}
+
+// PR10860
+struct Empty { };
+struct VirtualWithEmptyBase : Empty {
+ virtual void f();
+};
+
+// CHECK: define void @_Z25move_VirtualWithEmptyBaseR20VirtualWithEmptyBaseS0_
+void move_VirtualWithEmptyBase(VirtualWithEmptyBase &x, VirtualWithEmptyBase &y) {
+ // CHECK: call {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
+ x = static_cast<VirtualWithEmptyBase&&>(y);
+ // CHECK-NEXT: ret void
+}
+
+// move assignment ops
+
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_
+// array loop
+// CHECK-ASSIGN: br i1
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+
+// VirtualWithEmptyBase move assignment operatpr
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
+// CHECK-ASSIGN: store
+// CHECK-ASSIGN-NEXT: store
+// CHECK-NOT: call
+// CHECK: ret
+
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+
+// move ctors
+
+// CHECK-CTOR: define linkonce_odr void @_ZN1HC2EOS_
+// CHECK-CTOR: call void @_ZN1GC2EOS_
+// CHECK-CTOR: call void @_ZN1FC1EOS_
+// CHECK-CTOR: call void @_ZN1EC1EOS_
+// array loop
+// CHECK-CTOR: br i1
+// CHECK-CTOR: call void @_ZN1FC1EOS_
+
+// CHECK-CTOR: define linkonce_odr void @_ZN1GC2EOS_
+// CHECK-CTOR: call void @_ZN1EC1EOS_
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
new file mode 100644
index 000000000000..74f7eee9ee89
--- /dev/null
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -0,0 +1,164 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// Tests for implicit (non-)declaration of move constructor and
+// assignment: p9, p11, p20, p23.
+
+// This class, used as a member, allows to distinguish move from copy because
+// move operations are no-throw, copy operations aren't.
+struct ThrowingCopy {
+ ThrowingCopy() noexcept;
+ ThrowingCopy(ThrowingCopy &&) noexcept;
+ ThrowingCopy(const ThrowingCopy &) noexcept(false);
+ ThrowingCopy & operator =(ThrowingCopy &&) noexcept;
+ ThrowingCopy & operator =(const ThrowingCopy &) noexcept(false);
+};
+
+struct HasCopyConstructor {
+ ThrowingCopy tc;
+ HasCopyConstructor() noexcept;
+ HasCopyConstructor(const HasCopyConstructor &) noexcept(false);
+};
+
+struct HasCopyAssignment {
+ ThrowingCopy tc;
+ HasCopyAssignment() noexcept;
+ HasCopyAssignment & operator =(const HasCopyAssignment &) noexcept(false);
+};
+
+struct HasMoveConstructor { // expected-note {{implicit copy assignment}}
+ ThrowingCopy tc;
+ HasMoveConstructor() noexcept;
+ HasMoveConstructor(HasMoveConstructor &&) noexcept;
+};
+
+struct HasMoveAssignment { // expected-note {{implicit copy constructor}}
+ ThrowingCopy tc;
+ HasMoveAssignment() noexcept;
+ HasMoveAssignment & operator =(HasMoveAssignment &&) noexcept;
+};
+
+struct HasDestructor {
+ ThrowingCopy tc;
+ HasDestructor() noexcept;
+ ~HasDestructor() noexcept;
+};
+
+void test_basic_exclusion() {
+ static_assert(!noexcept(HasCopyConstructor((HasCopyConstructor()))), "");
+ HasCopyConstructor hcc;
+ static_assert(!noexcept(hcc = HasCopyConstructor()), "");
+
+ static_assert(!noexcept(HasCopyAssignment((HasCopyAssignment()))), "");
+ HasCopyAssignment hca;
+ static_assert(!noexcept(hca = HasCopyAssignment()), "");
+
+ static_assert(noexcept(HasMoveConstructor((HasMoveConstructor()))), "");
+ HasMoveConstructor hmc;
+ hmc = HasMoveConstructor(); // expected-error {{selected deleted operator}}
+
+ (HasMoveAssignment(HasMoveAssignment())); // expected-error {{uses deleted function}}
+ HasMoveAssignment hma;
+ static_assert(noexcept(hma = HasMoveAssignment()), "");
+
+ static_assert(!noexcept(HasDestructor((HasDestructor()))), "");
+ HasDestructor hd;
+ static_assert(!noexcept(hd = HasDestructor()), "");
+}
+
+struct PrivateMove {
+ PrivateMove() noexcept;
+ PrivateMove(const PrivateMove &) noexcept(false);
+ PrivateMove & operator =(const PrivateMove &) noexcept(false);
+private:
+ PrivateMove(PrivateMove &&) noexcept;
+ PrivateMove & operator =(PrivateMove &&) noexcept;
+};
+
+struct InheritsPrivateMove : PrivateMove {};
+struct ContainsPrivateMove {
+ PrivateMove pm;
+};
+
+struct PrivateDestructor {
+ PrivateDestructor() noexcept;
+ PrivateDestructor(const PrivateDestructor &) noexcept(false);
+ PrivateDestructor(PrivateDestructor &&) noexcept;
+private:
+ ~PrivateDestructor() noexcept;
+};
+
+struct InheritsPrivateDestructor : PrivateDestructor {}; // expected-note {{explicitly marked deleted}}
+struct ContainsPrivateDestructor { // expected-note {{explicitly marked deleted}}
+ PrivateDestructor pd;
+};
+
+struct NonTrivialCopyOnly {
+ NonTrivialCopyOnly() noexcept;
+ NonTrivialCopyOnly(const NonTrivialCopyOnly &) noexcept(false);
+ NonTrivialCopyOnly & operator =(const NonTrivialCopyOnly &) noexcept(false);
+};
+
+struct InheritsNonTrivialCopyOnly : NonTrivialCopyOnly {};
+struct ContainsNonTrivialCopyOnly {
+ NonTrivialCopyOnly ntco;
+};
+
+struct ContainsConst {
+ const int i;
+ ContainsConst() noexcept;
+ ContainsConst & operator =(ContainsConst &); // expected-note {{not viable}}
+};
+
+struct ContainsRef {
+ int &i;
+ ContainsRef() noexcept;
+ ContainsRef & operator =(ContainsRef &); // expected-note {{not viable}}
+};
+
+struct Base {
+ Base & operator =(Base &);
+};
+struct DirectVirtualBase : virtual Base {}; // expected-note {{copy assignment operator) not viable}}
+struct IndirectVirtualBase : DirectVirtualBase {}; // expected-note {{copy assignment operator) not viable}}
+
+void test_deletion_exclusion() {
+ // FIXME: How to test the union thing?
+
+ static_assert(!noexcept(InheritsPrivateMove(InheritsPrivateMove())), "");
+ static_assert(!noexcept(ContainsPrivateMove(ContainsPrivateMove())), "");
+ InheritsPrivateMove ipm;
+ static_assert(!noexcept(ipm = InheritsPrivateMove()), "");
+ ContainsPrivateMove cpm;
+ static_assert(!noexcept(cpm = ContainsPrivateMove()), "");
+
+ (InheritsPrivateDestructor(InheritsPrivateDestructor())); // expected-error {{call to deleted constructor}}
+ (ContainsPrivateDestructor(ContainsPrivateDestructor())); // expected-error {{call to deleted constructor}}
+
+ static_assert(!noexcept(InheritsNonTrivialCopyOnly(InheritsNonTrivialCopyOnly())), "");
+ static_assert(!noexcept(ContainsNonTrivialCopyOnly(ContainsNonTrivialCopyOnly())), "");
+ InheritsNonTrivialCopyOnly intco;
+ static_assert(!noexcept(intco = InheritsNonTrivialCopyOnly()), "");
+ ContainsNonTrivialCopyOnly cntco;
+ static_assert(!noexcept(cntco = ContainsNonTrivialCopyOnly()), "");
+
+ ContainsConst cc;
+ cc = ContainsConst(); // expected-error {{no viable}}
+
+ ContainsRef cr;
+ cr = ContainsRef(); // expected-error {{no viable}}
+
+ DirectVirtualBase dvb;
+ dvb = DirectVirtualBase(); // expected-error {{no viable}}
+
+ IndirectVirtualBase ivb;
+ ivb = IndirectVirtualBase(); // expected-error {{no viable}}
+}
+
+struct ContainsRValueRef {
+ int&& ri;
+ ContainsRValueRef() noexcept;
+};
+
+void test_contains_rref() {
+ (ContainsRValueRef(ContainsRValueRef()));
+}
diff --git a/test/CXX/special/class.copy/p11.0x.copy.cpp b/test/CXX/special/class.copy/p11.0x.copy.cpp
new file mode 100644
index 000000000000..752872adb9f5
--- /dev/null
+++ b/test/CXX/special/class.copy/p11.0x.copy.cpp
@@ -0,0 +1,90 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct NonTrivial {
+ NonTrivial(const NonTrivial&);
+};
+
+union DeletedNTVariant { // expected-note{{here}}
+ NonTrivial NT;
+ DeletedNTVariant();
+};
+DeletedNTVariant DVa;
+DeletedNTVariant DVb(DVa); // expected-error{{call to deleted constructor}}
+
+struct DeletedNTVariant2 { // expected-note{{here}}
+ union {
+ NonTrivial NT;
+ };
+ DeletedNTVariant2();
+};
+DeletedNTVariant2 DV2a;
+DeletedNTVariant2 DV2b(DV2a); // expected-error{{call to deleted constructor}}
+
+struct NoAccess {
+ NoAccess() = default;
+private:
+ NoAccess(const NoAccess&);
+
+ friend struct HasAccess;
+};
+
+struct HasNoAccess { // expected-note{{here}}
+ NoAccess NA;
+};
+HasNoAccess HNAa;
+HasNoAccess HNAb(HNAa); // expected-error{{call to deleted constructor}}
+
+struct HasAccess {
+ NoAccess NA;
+};
+
+HasAccess HAa;
+HasAccess HAb(HAa);
+
+struct NonConst {
+ NonConst(NonConst&);
+};
+struct Ambiguity {
+ Ambiguity(const Ambiguity&);
+ Ambiguity(volatile Ambiguity&);
+};
+
+struct IsAmbiguous { // expected-note{{here}}
+ NonConst NC;
+ Ambiguity A;
+ IsAmbiguous();
+};
+IsAmbiguous IAa;
+IsAmbiguous IAb(IAa); // expected-error{{call to deleted constructor}}
+
+struct Deleted { // expected-note{{here}}
+ IsAmbiguous IA;
+};
+Deleted Da;
+Deleted Db(Da); // expected-error{{call to deleted constructor}}
+
+struct NoAccessDtor {
+private:
+ ~NoAccessDtor();
+ friend struct HasAccessDtor;
+};
+
+struct HasNoAccessDtor { // expected-note{{here}}
+ NoAccessDtor NAD;
+ HasNoAccessDtor();
+ ~HasNoAccessDtor();
+};
+HasNoAccessDtor HNADa;
+HasNoAccessDtor HNADb(HNADa); // expected-error{{call to deleted constructor}}
+
+struct HasAccessDtor {
+ NoAccessDtor NAD;
+};
+HasAccessDtor HADa;
+HasAccessDtor HADb(HADa);
+
+struct RValue { // expected-note{{here}}
+ int && ri = 1;
+};
+RValue RVa;
+RValue RVb(RVa); // expected-error{{call to deleted constructor}}
diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp
new file mode 100644
index 000000000000..402bc31d5eec
--- /dev/null
+++ b/test/CXX/special/class.copy/p11.0x.move.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct NonTrivial {
+ NonTrivial(NonTrivial&&);
+};
+
+union DeletedNTVariant {
+ NonTrivial NT;
+ DeletedNTVariant(DeletedNTVariant&&);
+};
+DeletedNTVariant::DeletedNTVariant(DeletedNTVariant&&) = default; // expected-error{{would delete}}
+
+struct DeletedNTVariant2 {
+ union {
+ NonTrivial NT;
+ };
+ DeletedNTVariant2(DeletedNTVariant2&&);
+};
+DeletedNTVariant2::DeletedNTVariant2(DeletedNTVariant2&&) = default; // expected-error{{would delete}}
+
+struct NoAccess {
+ NoAccess() = default;
+private:
+ NoAccess(NoAccess&&);
+
+ friend struct HasAccess;
+};
+
+struct HasNoAccess {
+ NoAccess NA;
+ HasNoAccess(HasNoAccess&&);
+};
+HasNoAccess::HasNoAccess(HasNoAccess&&) = default; // expected-error{{would delete}}
+
+struct HasAccess {
+ NoAccess NA;
+ HasAccess(HasAccess&&);
+};
+HasAccess::HasAccess(HasAccess&&) = default;
+
+struct NoAccessDtor {
+ NoAccessDtor(NoAccessDtor&&);
+private:
+ ~NoAccessDtor();
+ friend struct HasAccessDtor;
+};
+
+struct HasNoAccessDtor {
+ NoAccessDtor NAD;
+ HasNoAccessDtor(HasNoAccessDtor&&);
+};
+HasNoAccessDtor::HasNoAccessDtor(HasNoAccessDtor&&) = default; // expected-error{{would delete}}
+
+struct HasAccessDtor {
+ NoAccessDtor NAD;
+ HasAccessDtor(HasAccessDtor&&);
+};
+HasAccessDtor::HasAccessDtor(HasAccessDtor&&) = default;
+
+struct RValue {
+ int &&ri = 1;
+ RValue(RValue&&);
+};
+RValue::RValue(RValue&&) = default;
+
+struct CopyOnly {
+ CopyOnly(const CopyOnly&);
+};
+
+struct NonMove {
+ CopyOnly CO;
+ NonMove(NonMove&&);
+};
+NonMove::NonMove(NonMove&&) = default; // expected-error{{would delete}}
+
+struct Moveable {
+ Moveable();
+ Moveable(Moveable&&);
+};
+
+struct HasMove {
+ Moveable M;
+ HasMove(HasMove&&);
+};
+HasMove::HasMove(HasMove&&) = default;
diff --git a/test/CXX/special/class.copy/p15-0x.cpp b/test/CXX/special/class.copy/p15-0x.cpp
new file mode 100644
index 000000000000..32b2714fd702
--- /dev/null
+++ b/test/CXX/special/class.copy/p15-0x.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+namespace PR10622 {
+ struct foo {
+ const int first;
+ foo(const foo&) = default;
+ };
+ void find_or_insert(const foo& __obj) {
+ foo x(__obj);
+ }
+
+ struct bar : foo {
+ bar(const bar&) = default;
+ };
+ void test_bar(const bar &obj) {
+ bar obj2(obj);
+ }
+}
diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp
index b196865c8225..b66e19ab4c4f 100644
--- a/test/CXX/special/class.copy/p33-0x.cpp
+++ b/test/CXX/special/class.copy/p33-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fsyntax-only -verify %s
class X {
X(const X&);
diff --git a/test/CXX/special/class.ctor/p4-0x.cpp b/test/CXX/special/class.ctor/p4-0x.cpp
index e3508e2e8c47..509beb490302 100644
--- a/test/CXX/special/class.ctor/p4-0x.cpp
+++ b/test/CXX/special/class.ctor/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A constructor shall not be declared with a ref-qualifier.
struct X {
diff --git a/test/CXX/special/class.ctor/p5-0x.cpp b/test/CXX/special/class.ctor/p5-0x.cpp
index 2123d1662358..de2dea5be16b 100644
--- a/test/CXX/special/class.ctor/p5-0x.cpp
+++ b/test/CXX/special/class.ctor/p5-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
struct DefaultedDefCtor1 {};
struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; };
@@ -23,10 +23,6 @@ int n;
// default constructor,
union Deleted1a { UserProvidedDefCtor u; }; // expected-note {{deleted here}}
Deleted1a d1a; // expected-error {{deleted constructor}}
-// FIXME: treating this as having a deleted default constructor is probably a
-// bug in the standard.
-union Deleted1b { UserProvidedDefCtor u = UserProvidedDefCtor(); }; // expected-note {{deleted here}}
-Deleted1b d1b; // expected-error {{deleted constructor}}
union NotDeleted1a { DefaultedDefCtor1 nu; };
NotDeleted1a nd1a;
// FIXME: clang implements the pre-FDIS rule, under which DefaultedDefCtor2's
diff --git a/test/CXX/special/class.dtor/p2-0x.cpp b/test/CXX/special/class.dtor/p2-0x.cpp
index 53a2e033efc1..c7b1b586fbcb 100644
--- a/test/CXX/special/class.dtor/p2-0x.cpp
+++ b/test/CXX/special/class.dtor/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A destructor shall not be declared with a ref-qualifier.
struct X {
diff --git a/test/CXX/special/class.dtor/p3-0x.cpp b/test/CXX/special/class.dtor/p3-0x.cpp
index 6cdd167983bc..44bf5aa01978 100644
--- a/test/CXX/special/class.dtor/p3-0x.cpp
+++ b/test/CXX/special/class.dtor/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
struct A {
~A();
diff --git a/test/CXX/special/class.inhctor/elsewhere.cpp b/test/CXX/special/class.inhctor/elsewhere.cpp
index 82944d65dfd1..60cfff80889e 100644
--- a/test/CXX/special/class.inhctor/elsewhere.cpp
+++ b/test/CXX/special/class.inhctor/elsewhere.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Tests related to constructor inheriting, but not specified in [class.inhctor]
diff --git a/test/CXX/special/class.inhctor/p3.cpp b/test/CXX/special/class.inhctor/p3.cpp
index 021f701ab495..989c17c8b462 100644
--- a/test/CXX/special/class.inhctor/p3.cpp
+++ b/test/CXX/special/class.inhctor/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct B1 {
B1(int);
@@ -14,7 +14,7 @@ D1 fd1() { return 1; }
struct B2 {
explicit B2(int, int = 0, int = 0);
};
-struct D2 : B2 { // expected-note {{candidate constructor}}
+struct D2 : B2 { // expected-note 2 {{candidate constructor}}
using B2::B2;
};
D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);
@@ -24,7 +24,7 @@ D2 fd2() { return 1; } // expected-error {{no viable conversion}}
struct B3 {
B3(void*); // expected-note {{inherited from here}}
};
-struct D3 : B3 { // expected-note {{candidate constructor}}
+struct D3 : B3 { // expected-note 2 {{candidate constructor}}
using B3::B3; // expected-note {{candidate constructor (inherited)}}
};
D3 fd3() { return 1; } // expected-error {{no viable conversion}}
diff --git a/test/CXX/special/class.inhctor/p7.cpp b/test/CXX/special/class.inhctor/p7.cpp
index 3ad761f08baa..736754d8a3e3 100644
--- a/test/CXX/special/class.inhctor/p7.cpp
+++ b/test/CXX/special/class.inhctor/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Straight from the standard
struct B1 {
diff --git a/test/CXX/special/class.init/class.base.init/p8-0x.cpp b/test/CXX/special/class.init/class.base.init/p8-0x.cpp
index 8512a9f7bb3a..3e26e4992d0d 100644
--- a/test/CXX/special/class.init/class.base.init/p8-0x.cpp
+++ b/test/CXX/special/class.init/class.base.init/p8-0x.cpp
@@ -1,15 +1,19 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
int n;
struct S {
int &a; // expected-note 2{{here}}
int &b = n;
+ union {
+ const int k = 42;
+ };
+
S() {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
S(int) : a(n) {} // ok
S(char) : b(n) {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
S(double) : a(n), b(n) {} // ok
-};
+} s(0);
union U {
int a = 0;
@@ -21,3 +25,35 @@ union U {
U(char) : b('y') {} // desired-error {{at most one member of a union may be initialized}}
U(double) : a(1), b('y') {} // desired-error {{at most one member of a union may be initialized}}
};
+
+// PR10954: variant members do not acquire an implicit initializer.
+namespace VariantMembers {
+ struct NoDefaultCtor {
+ NoDefaultCtor(int);
+ };
+ union V {
+ NoDefaultCtor ndc;
+ int n;
+
+ V() {}
+ V(int n) : n(n) {}
+ V(int n, bool) : ndc(n) {}
+ };
+ struct K {
+ union {
+ NoDefaultCtor ndc;
+ int n;
+ };
+ K() {}
+ K(int n) : n(n) {}
+ K(int n, bool) : ndc(n) {}
+ };
+ struct Nested {
+ Nested() {}
+ union {
+ struct {
+ NoDefaultCtor ndc;
+ };
+ };
+ };
+}
diff --git a/test/CXX/special/class.init/class.base.init/p9-0x.cpp b/test/CXX/special/class.init/class.base.init/p9-0x.cpp
index 039b1c271a3d..ca5e8072d82f 100644
--- a/test/CXX/special/class.init/class.base.init/p9-0x.cpp
+++ b/test/CXX/special/class.init/class.base.init/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++0x %s -O1 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++11 %s -O1 -emit-llvm -o - | FileCheck %s
struct S {
int n = 10;
diff --git a/test/CXX/special/class.temporary/p1.cpp b/test/CXX/special/class.temporary/p1.cpp
new file mode 100644
index 000000000000..384b1f89fda8
--- /dev/null
+++ b/test/CXX/special/class.temporary/p1.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+namespace test0 {
+ struct A {
+ A() = default;
+ int x;
+ int y;
+
+ A(const A&) = delete; // expected-note {{function has been explicitly marked deleted here}}
+ };
+
+ void foo(...);
+
+ void test() {
+ A a;
+ foo(a); // expected-error {{call to deleted constructor of 'test0::A'}}
+ }
+}
+
+namespace test1 {
+ struct A {
+ A() = default;
+ int x;
+ int y;
+
+ private:
+ A(const A&) = default; // expected-note {{declared private here}}
+ };
+
+ void foo(...);
+
+ void test() {
+ A a;
+ // FIXME: this error about variadics is bogus
+ foo(a); // expected-error {{calling a private constructor of class 'test1::A'}} expected-error {{cannot pass object of non-trivial type 'test1::A' through variadic function}}
+ }
+}
+
+// Don't enforce this in an unevaluated context.
+namespace test2 {
+ struct A {
+ A(const A&) = delete; // expected-note {{marked deleted here}}
+ };
+
+ typedef char one[1];
+ typedef char two[2];
+
+ one &meta(bool);
+ two &meta(...);
+
+ void a(A &a) {
+ char check[sizeof(meta(a)) == 2 ? 1 : -1];
+ }
+
+ void b(A &a) {
+ meta(a); // expected-error {{call to deleted constructor}}
+ }
+}