When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150611 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
index 16c5664..9df4199 100644
--- a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
+++ b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
@@ -7,27 +7,27 @@
   ~non_trivial();
 };
 
-union bad_union { // expected-note {{marked deleted here}}
+union bad_union { // expected-note {{defined here}}
   non_trivial nt;
 };
-bad_union u; // expected-error {{call to deleted constructor}}
-union bad_union2 { // expected-note {{marked deleted here}}
+bad_union u; // expected-error {{call to implicitly-deleted default constructor}}
+union bad_union2 { // expected-note {{defined here}}
   const int i;
 };
-bad_union2 u2; // expected-error {{call to deleted constructor}}
+bad_union2 u2; // expected-error {{call to implicitly-deleted default constructor}}
 
-struct bad_anon { // expected-note {{marked deleted here}}
+struct bad_anon { // expected-note {{defined here}}
   union {
     non_trivial nt;
   };
 };
-bad_anon a; // expected-error {{call to deleted constructor}}
-struct bad_anon2 { // expected-note {{marked deleted here}}
+bad_anon a; // expected-error {{call to implicitly-deleted default constructor}}
+struct bad_anon2 { // expected-note {{defined here}}
   union {
     const int i;
   };
 };
-bad_anon2 a2; // expected-error {{call to deleted constructor}}
+bad_anon2 a2; // expected-error {{call to implicitly-deleted default constructor}}
 
 // This would be great except that we implement
 union good_union {
@@ -48,10 +48,10 @@
 };
 good g;
 
-struct bad_const { // expected-note {{marked deleted here}}
+struct bad_const { // expected-note {{defined here}}
   const good g;
 };
-bad_const bc; // expected-error {{call to deleted constructor}}
+bad_const bc; // expected-error {{call to implicitly-deleted default constructor}}
 
 struct good_const {
   const non_trivial nt;
@@ -65,38 +65,38 @@
   ~no_dtor() = delete;
 };
 
-struct bad_field_default { // expected-note {{marked deleted here}}
+struct bad_field_default { // expected-note {{defined 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_field_default bfd; // expected-error {{call to implicitly-deleted default constructor}}
+struct bad_base_default : no_default { // expected-note {{defined here}}
 };
-bad_base_default bbd; // expected-error {{call to deleted constructor}}
+bad_base_default bbd; // expected-error {{call to implicitly-deleted default constructor}}
 
-struct bad_field_dtor { // expected-note {{marked deleted here}}
+struct bad_field_dtor { // expected-note {{defined 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_field_dtor bfx; // expected-error {{call to implicitly-deleted default constructor}}
+struct bad_base_dtor : no_dtor { // expected-note {{defined here}}
 };
-bad_base_dtor bbx; // expected-error {{call to deleted constructor}}
+bad_base_dtor bbx; // expected-error {{call to implicitly-deleted default constructor}}
 
 struct ambiguous_default {
   ambiguous_default();
   ambiguous_default(int = 2);
 };
-struct has_amb_field { // expected-note {{marked deleted here}}
+struct has_amb_field { // expected-note {{defined here}}
   ambiguous_default ad;
 };
-has_amb_field haf; // expected-error {{call to deleted constructor}}
+has_amb_field haf; // expected-error {{call to implicitly-deleted default constructor}}
 
 class inaccessible_default {
   inaccessible_default();
 };
-struct has_inacc_field { // expected-note {{marked deleted here}}
+struct has_inacc_field { // expected-note {{defined here}}
   inaccessible_default id;
 };
-has_inacc_field hif; // expected-error {{call to deleted constructor}}
+has_inacc_field hif; // expected-error {{call to implicitly-deleted default constructor}}
 
 class friend_default {
   friend struct has_friend;
@@ -107,11 +107,11 @@
 };
 has_friend hf;
 
-struct defaulted_delete {
+struct defaulted_delete { // expected-note {{defined here}}
   no_default nd;
-  defaulted_delete() = default; // expected-note {{marked deleted here}}
+  defaulted_delete() = default; // expected-note{{declared here}}
 };
-defaulted_delete dd; // expected-error {{call to deleted constructor}}
+defaulted_delete dd; // expected-error {{call to implicitly-deleted default constructor}}
 
 struct late_delete {
   no_default nd;
@@ -121,12 +121,12 @@
 
 // See also rdar://problem/8125400.
 namespace empty {
-  static union {}; // expected-error {{deleted constructor}} expected-note {{here}}
+  static union {}; // expected-error {{implicitly-deleted default constructor}} expected-note {{here}}
   static union { union {}; };
   static union { struct {}; };
   static union { union { union {}; }; };
   static union { union { struct {}; }; };
-  static union { struct { union {}; }; }; // expected-error {{deleted constructor}} expected-note {{here}}
+  static union { struct { union {}; }; }; // expected-error {{implicitly-deleted default constructor}} expected-note {{here}}
   static union { struct { struct {}; }; };
 }
 
diff --git a/test/SemaCXX/dr1301.cpp b/test/SemaCXX/dr1301.cpp
index e3d63be..a348977 100644
--- a/test/SemaCXX/dr1301.cpp
+++ b/test/SemaCXX/dr1301.cpp
@@ -14,13 +14,13 @@
 struct C { // expected-note {{here}}
   B b;
 };
-int c = C().b.n; // expected-error {{call to deleted}}
+int c = C().b.n; // expected-error {{call to implicitly-deleted default}}
 
-struct D {
-  D() = default; // expected-note {{here}}
+struct D { // expected-note {{defined here}}
+  D() = default; // expected-note {{declared here}}
   B b;
 };
-int d = D().b.n; // expected-error {{call to deleted}}
+int d = D().b.n; // expected-error {{call to implicitly-deleted default}}
 
 struct E {
   E() = default;
@@ -37,7 +37,7 @@
 union G { // expected-note {{here}}
   F f;
 };
-int g = G().f.n; // expected-error {{call to deleted}}
+int g = G().f.n; // expected-error {{call to implicitly-deleted default}}
 
 struct H {
   int n;
@@ -49,7 +49,7 @@
 struct I { // expected-note {{here}}
   H h;
 };
-int i = I().h.n; // expected-error {{call to deleted}}
+int i = I().h.n; // expected-error {{call to implicitly-deleted default}}
 
 struct J {
   J();
@@ -63,5 +63,5 @@
   J j;
   int m;
 };
-int k1 = K().j.n; // expected-error {{call to deleted}}
-int k2 = K().j.f(); // expected-error {{call to deleted}}
+int k1 = K().j.n; // expected-error {{call to implicitly-deleted default}}
+int k2 = K().j.f(); // expected-error {{call to implicitly-deleted default}}
diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp
index 559c301..f8ee767 100644
--- a/test/SemaCXX/implicit-exception-spec.cpp
+++ b/test/SemaCXX/implicit-exception-spec.cpp
@@ -54,10 +54,9 @@
 // The same problem arises in delayed parsing of default arguments,
 // which clang does not yet support.
 namespace DefaultArgument {
-  // FIXME: this diagnostic is completely wrong.
-  struct Default { // expected-note {{explicitly marked deleted here}}
+  struct Default { // expected-note {{defined here}}
     struct T {
-      T(int = ExceptionIf<noexcept(Default())::f()); // expected-error {{call to deleted constructor}}
+      T(int = ExceptionIf<noexcept(Default())::f()); // expected-error {{call to implicitly-deleted default constructor}}
     } t;
   };
 }
diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp
index 19be03a..3b552e2 100644
--- a/test/SemaCXX/value-initialization.cpp
+++ b/test/SemaCXX/value-initialization.cpp
@@ -1,11 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
 
-struct A { //expected-note {{marked deleted here}} \
+struct A { //expected-note {{defined here}} \
      // expected-warning {{does not declare any constructor to initialize}}
      const int i; // expected-note{{const member 'i' will never be initialized}}
      virtual void f() { } 
 };
 
 int main () {
-      (void)A(); // expected-error {{call to deleted constructor}}
+      (void)A(); // expected-error {{call to implicitly-deleted default constructor}}
 }