aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/deleted-function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/deleted-function.cpp')
-rw-r--r--test/SemaCXX/deleted-function.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/SemaCXX/deleted-function.cpp b/test/SemaCXX/deleted-function.cpp
index d7ef9b263d88..bd6fc09eeb77 100644
--- a/test/SemaCXX/deleted-function.cpp
+++ b/test/SemaCXX/deleted-function.cpp
@@ -65,3 +65,31 @@ template void test3<int>();
void test4() {} // expected-note {{previous definition is here}}
void test4() = delete; // expected-error {{redefinition of 'test4'}}
+
+struct DelCtor { // expected-note 4{{implicit}}
+ DelCtor(int) = delete; // expected-note 14{{deleted}}
+ // ensure the class is not an aggregate
+ DelCtor(int, int, int, int);
+};
+DelCtor dc1 = 0; // expected-error {{deleted}}
+DelCtor dc2(0); // expected-error {{deleted}}
+DelCtor dc3 = {0}; // expected-error {{deleted}}
+DelCtor dc4{0}; // expected-error {{deleted}}
+DelCtor dc5 = (DelCtor)0; // expected-error {{deleted}}
+DelCtor dc6 = DelCtor(0); // expected-error {{deleted}}
+DelCtor dc7 = DelCtor{0}; // expected-error {{deleted}}
+DelCtor *dc8 = new DelCtor(0); // expected-error {{deleted}}
+DelCtor *dc9 = new DelCtor{0}; // expected-error {{deleted}}
+DelCtor dc10[] = {0}; // expected-error {{deleted}}
+int use_dc(DelCtor); // expected-note 2{{here}}
+int dc11 = use_dc(0); // expected-error {{deleted}}
+int dc12 = use_dc({0}); // expected-error {{deleted}}
+int use_dcr(const DelCtor &); // expected-note {{here}}
+int dc13 = use_dcr(0); // expected-error {{deleted}}
+int dc14 = use_dcr({0}); // expected-error {{deleted}}
+
+struct DelCtorTemplate {
+ template<typename T> DelCtorTemplate(T) = delete; // expected-note {{deleted}}
+};
+int use_dct(const DelCtorTemplate &);
+int dc15 = use_dct(0); // expected-error {{deleted}}