[cfe-commits] r131486 - /cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp

Sean Hunt scshunt at csclub.uwaterloo.ca
Tue May 17 13:44:39 PDT 2011


Author: coppro
Date: Tue May 17 15:44:39 2011
New Revision: 131486

URL: http://llvm.org/viewvc/llvm-project?rev=131486&view=rev
Log:
Add some more tests.

I have on that's #if 0'ed out, and I don't know why it's failing to
delete the constructor. I'd appreciate if someone familiar with access
control could look into ShouldDeleteDefaultConstructor - thanks.

Modified:
    cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp

Modified: cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp?rev=131486&r1=131485&r2=131486&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp Tue May 17 15:44:39 2011
@@ -47,3 +47,77 @@
   non_trivial nt;
 };
 good g;
+
+struct bad_const { // expected-note {{marked deleted here}}
+  const good g;
+};
+bad_const bc; // expected-error {{call to deleted constructor}}
+
+struct good_const {
+  const non_trivial nt;
+};
+good_const gc;
+
+struct no_default {
+  no_default() = delete;
+};
+struct no_dtor {
+  ~no_dtor() = delete;
+};
+
+struct bad_field_default { // expected-note {{marked deleted here}}
+  no_default nd;
+};
+bad_field_default bfd; // expected-error {{call to deleted constructor}}
+struct bad_base_default : no_default { // expected-note {{marked deleted here}}
+};
+bad_base_default bbd; // expected-error {{call to deleted constructor}}
+
+struct bad_field_dtor { // expected-note {{marked deleted here}}
+  no_dtor nd;
+};
+bad_field_dtor bfx; // expected-error {{call to deleted constructor}}
+struct bad_base_dtor : no_dtor { // expected-note {{marked deleted here}}
+};
+bad_base_dtor bbx; // expected-error {{call to deleted constructor}}
+
+struct ambiguous_default {
+  ambiguous_default();
+  ambiguous_default(int = 2);
+};
+struct has_amb_field { // expected-note {{marked deleted here}}
+  ambiguous_default ad;
+};
+has_amb_field haf; // expected-error {{call to deleted constructor}}
+
+// FIXME: This should fail due to deletion
+#if 0
+class inaccessible_default {
+  inaccessible_default();
+};
+struct has_inacc_field {
+  inaccessible_default id;
+};
+has_inacc_field hif;
+#endif
+
+class friend_default {
+  friend struct has_friend;
+  friend_default();
+};
+struct has_friend {
+  friend_default fd;
+};
+has_friend hf;
+
+struct defaulted_delete {
+  no_default nd;
+  defaulted_delete() = default; // expected-note {{marked deleted here}}
+};
+defaulted_delete dd; // expected-error {{call to deleted constructor}}
+
+struct late_delete {
+  no_default nd;
+  late_delete();
+};
+late_delete::late_delete() = default; // expected-error {{would delete it}}





More information about the cfe-commits mailing list