r230370 - Add test that we reject invocations of deleted constructors. One of these
Richard Smith
richard-llvm at metafoo.co.uk
Tue Feb 24 12:41:37 PST 2015
Author: rsmith
Date: Tue Feb 24 14:41:36 2015
New Revision: 230370
URL: http://llvm.org/viewvc/llvm-project?rev=230370&view=rev
Log:
Add test that we reject invocations of deleted constructors. One of these
constructs is not rejected by should be; that's PR22673.
Modified:
cfe/trunk/test/SemaCXX/deleted-function.cpp
Modified: cfe/trunk/test/SemaCXX/deleted-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/deleted-function.cpp?rev=230370&r1=230369&r2=230370&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/deleted-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/deleted-function.cpp Tue Feb 24 14:41:36 2015
@@ -65,3 +65,25 @@ 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 13{{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); // FIXME PR22673: should reject this
+int dc14 = use_dcr({0}); // expected-error {{deleted}}
More information about the cfe-commits
mailing list