]> granicus.if.org Git - clang/commitdiff
Improve the diagnostics used to report implicitly-generated class members
authorJohn McCall <rjmccall@apple.com>
Wed, 6 Jan 2010 09:43:14 +0000 (09:43 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 6 Jan 2010 09:43:14 +0000 (09:43 +0000)
as parts of overload sets.  Also, refer to constructors as 'constructors'
rather than functions.

Adjust a lot of tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92832 91177308-0d34-0410-b5e6-96231b3b80d8

32 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/Sema.h
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaExprCXX.cpp
lib/Sema/SemaOverload.cpp
test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
test/CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
test/CXX/temp/temp.param/p3.cpp
test/CXX/temp/temp.spec/temp.expl.spec/p15.cpp
test/CXX/temp/temp.spec/temp.expl.spec/p4.cpp
test/CXX/temp/temp.spec/temp.explicit/p1.cpp
test/SemaCXX/condition.cpp
test/SemaCXX/constructor-initializer.cpp
test/SemaCXX/conversion-function.cpp
test/SemaCXX/converting-constructor.cpp
test/SemaCXX/copy-initialization.cpp
test/SemaCXX/dcl_init_aggr.cpp
test/SemaCXX/decl-init-ref.cpp
test/SemaCXX/default2.cpp
test/SemaCXX/direct-initializer.cpp
test/SemaCXX/functional-cast.cpp
test/SemaCXX/namespace.cpp
test/SemaCXX/nested-name-spec.cpp
test/SemaCXX/overloaded-builtin-operators.cpp
test/SemaCXX/rval-references.cpp
test/SemaTemplate/constructor-template.cpp
test/SemaTemplate/default-expr-arguments.cpp
test/SemaTemplate/explicit-instantiation.cpp
test/SemaTemplate/fun-template-def.cpp
test/SemaTemplate/instantiate-expr-4.cpp
test/SemaTemplate/instantiate-static-var.cpp

index fac4f7e1a5d0eb9a38190fcbc2e8be1fd39550b6..9d5ef0b40278f048dc4ca050d5d01ac26cf03bf7 100644 (file)
@@ -895,18 +895,26 @@ def err_ovl_ambiguous_member_call : Error<
   "call to member function %0 is ambiguous">;
 def err_ovl_deleted_member_call : Error<
   "call to %select{unavailable|deleted}0 member function %1">;
-def err_ovl_candidate : Note<"candidate function">;
-def err_ovl_candidate_not_viable : Note<"function not viable because"
-                                        " of ambiguity in conversion of argument %0">;
+def note_ovl_candidate : Note<"candidate function">;
+def note_ovl_candidate_not_viable : Note<"function not viable because"
+                          " of ambiguity in conversion of argument %0">;
+def note_ovl_candidate_ctor : Note<"candidate constructor">;
+def note_ovl_candidate_implicit_copy_ctor : Note<
+    "candidate is the implicit copy constructor">;
+def note_ovl_candidate_implicit_default_ctor : Note<
+    "candidate is the implicit default constructor">;
+def note_ovl_candidate_meth : Note<"candidate function">;
+def note_ovl_candidate_implicit_copy_assign : Note<
+    "candidate is the implicit copy assignment operator">;
 def note_ambiguous_type_conversion: Note<
     "because of ambiguity in conversion of %0 to %1">;
-def err_ovl_template_candidate : Note<
+def note_ovl_template_candidate : Note<
   "candidate function template specialization %0">;
-def err_ovl_candidate_deleted : Note<
+def note_ovl_candidate_deleted : Note<
   "candidate function has been explicitly %select{made unavailable|deleted}0">;
-def err_ovl_builtin_binary_candidate : Note<
+def note_ovl_builtin_binary_candidate : Note<
     "built-in candidate %0">;
-def err_ovl_builtin_unary_candidate : Note<
+def note_ovl_builtin_unary_candidate : Note<
     "built-in candidate %0">;
 def err_ovl_no_viable_function_in_init : Error<
   "no matching constructor for initialization of %0">;
@@ -927,7 +935,7 @@ def err_ovl_ambiguous_object_call : Error<
   "call to object of type %0 is ambiguous">;
 def err_ovl_deleted_object_call : Error<
   "call to %select{unavailable|deleted}0 function call operator in type %1">;
-def err_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
+def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
 def err_member_call_without_object : Error<
   "call to non-static member function without an object argument">;
 
index 87ebea72f216a8eaeffc9d330c7bf7a24f3d5d72..7838bbe9c5065f6a975f14162726e7dc58c36043 100644 (file)
@@ -1032,6 +1032,7 @@ public:
                          bool OnlyViable,
                          const char *Opc=0,
                          SourceLocation Loc=SourceLocation());
+  void NoteOverloadCandidate(FunctionDecl *Fn);
 
   FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
                                                    bool Complain);
index 623bf8ae7e39b58da2f5b2fbcad13202f2c72369..c9757d728a64427c1f2edb47636c5ff6433f8bc0 100644 (file)
@@ -4695,7 +4695,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType,
         for (int j = Conversions.ConversionFunctionSet.size()-1; 
              j >= 0; j--) {
           FunctionDecl *Func = Conversions.ConversionFunctionSet[j];
-          Diag(Func->getLocation(), diag::err_ovl_candidate);
+          NoteOverloadCandidate(Func);
         }
       }
       else {
index 82a2d99579611b3f8beb195b29b74d026f44bc1e..130b6e857b7e165fc82e56b08d5a3d06a754cadd 100644 (file)
@@ -921,7 +921,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
               << Type << Ex->getSourceRange();
         for (unsigned i= 0; i < ObjectPtrConversions.size(); i++) {
           CXXConversionDecl *Conv = ObjectPtrConversions[i];
-          Diag(Conv->getLocation(), diag::err_ovl_candidate);
+          NoteOverloadCandidate(Conv);
         }
         return ExprError();
       }
index 5892081736697cf8a6d3959fbea331205dca7ed8..cec167953c88ec5d123839992c3b150e5765df47 100644 (file)
@@ -4274,6 +4274,44 @@ OverloadingResult Sema::BestViableFunction(OverloadCandidateSet& CandidateSet,
   return OR_Success;
 }
 
+/// Notes the location of an overload candidate.
+void Sema::NoteOverloadCandidate(FunctionDecl *Fn) {
+
+  if (CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(Fn)) {
+    // At least call it a 'constructor'.
+    if (!Ctor->isImplicit()) {
+      Diag(Ctor->getLocation(), diag::note_ovl_candidate_ctor);
+      return;
+    }
+
+    CXXRecordDecl *Record = Ctor->getParent();
+    if (Ctor->isCopyConstructor()) {
+      Diag(Record->getLocation(), diag::note_ovl_candidate_implicit_copy_ctor);
+      return;
+    }
+
+    Diag(Record->getLocation(), diag::note_ovl_candidate_implicit_default_ctor);
+    return;
+  }
+
+  if (CXXMethodDecl *Meth = dyn_cast<CXXMethodDecl>(Fn)) {
+    // This actually gets spelled 'candidate function' for now, but
+    // it doesn't hurt to split it out.
+    if (!Meth->isImplicit()) {
+      Diag(Meth->getLocation(), diag::note_ovl_candidate_meth);
+      return;
+    }
+
+    assert(Meth->isCopyAssignment()
+           && "implicit method is not copy assignment operator?");
+    Diag(Meth->getParent()->getLocation(),
+         diag::note_ovl_candidate_implicit_copy_assign);
+    return;
+  }
+
+  Diag(Fn->getLocation(), diag::note_ovl_candidate);
+}
+
 /// PrintOverloadCandidates - When overload resolution fails, prints
 /// diagnostic messages containing the candidates in the candidate
 /// set. If OnlyViable is true, only viable candidates will be printed.
@@ -4291,13 +4329,13 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
         if (Cand->Function->isDeleted() ||
             Cand->Function->getAttr<UnavailableAttr>()) {
           // Deleted or "unavailable" function.
-          Diag(Cand->Function->getLocation(), diag::err_ovl_candidate_deleted)
+          Diag(Cand->Function->getLocation(), diag::note_ovl_candidate_deleted)
             << Cand->Function->isDeleted();
         } else if (FunctionTemplateDecl *FunTmpl 
                      = Cand->Function->getPrimaryTemplate()) {
           // Function template specialization
           // FIXME: Give a better reason!
-          Diag(Cand->Function->getLocation(), diag::err_ovl_template_candidate)
+          Diag(Cand->Function->getLocation(), diag::note_ovl_template_candidate)
             << getTemplateArgumentBindingsText(FunTmpl->getTemplateParameters(),
                               *Cand->Function->getTemplateSpecializationArgs());
         } else {
@@ -4312,17 +4350,17 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
                   Conversion.ConversionFunctionSet.size() == 0)
                 continue;
               Diag(Cand->Function->getLocation(), 
-                   diag::err_ovl_candidate_not_viable) << (i+1);
+                   diag::note_ovl_candidate_not_viable) << (i+1);
               errReported = true;
               for (int j = Conversion.ConversionFunctionSet.size()-1; 
                    j >= 0; j--) {
                 FunctionDecl *Func = Conversion.ConversionFunctionSet[j];
-                Diag(Func->getLocation(), diag::err_ovl_candidate);
+                NoteOverloadCandidate(Func);
               }
             }
           }
           if (!errReported)
-            Diag(Cand->Function->getLocation(), diag::err_ovl_candidate);
+            NoteOverloadCandidate(Cand->Function);
         }
       } else if (Cand->IsSurrogate) {
         // Desugar the type of the surrogate down to a function type,
@@ -4352,7 +4390,7 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
         if (isRValueReference) FnType = Context.getRValueReferenceType(FnType);
         if (isLValueReference) FnType = Context.getLValueReferenceType(FnType);
 
-        Diag(Cand->Surrogate->getLocation(), diag::err_ovl_surrogate_cand)
+        Diag(Cand->Surrogate->getLocation(), diag::note_ovl_surrogate_cand)
           << FnType;
       } else if (OnlyViable) {
         assert(Cand->Conversions.size() <= 2 && 
@@ -4363,13 +4401,13 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
         TypeStr += Cand->BuiltinTypes.ParamTypes[0].getAsString();
         if (Cand->Conversions.size() == 1) {
           TypeStr += ")";
-          Diag(OpLoc, diag::err_ovl_builtin_unary_candidate) << TypeStr;
+          Diag(OpLoc, diag::note_ovl_builtin_unary_candidate) << TypeStr;
         }
         else {
           TypeStr += ", ";
           TypeStr += Cand->BuiltinTypes.ParamTypes[1].getAsString();
           TypeStr += ")";
-          Diag(OpLoc, diag::err_ovl_builtin_binary_candidate) << TypeStr;
+          Diag(OpLoc, diag::note_ovl_builtin_binary_candidate) << TypeStr;
         }
       }
       else if (!Cand->Viable && !Reported) {
@@ -4393,7 +4431,7 @@ Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
           for (unsigned j = 0; j < ICS.ConversionFunctionSet.size(); j++) {
             FunctionDecl *Func = 
               Cand->Conversions[ArgIdx].ConversionFunctionSet[j];
-            Diag(Func->getLocation(),diag::err_ovl_candidate);
+            NoteOverloadCandidate(Func);
           }
         }
         Reported = true;
@@ -4586,7 +4624,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
                            PDiag(),
                            PDiag(diag::err_addr_ovl_ambiguous)
                                << TemplateMatches[0]->getDeclName(),
-                           PDiag(diag::err_ovl_template_candidate));
+                           PDiag(diag::note_ovl_template_candidate));
     MarkDeclarationReferenced(From->getLocStart(), Result);
     return Result;
   }
@@ -4611,7 +4649,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,
   Diag(From->getLocStart(), diag::err_addr_ovl_ambiguous)
     << RemainingMatches[0]->getDeclName();
   for (unsigned I = 0, N = RemainingMatches.size(); I != N; ++I)
-    Diag(RemainingMatches[I]->getLocation(), diag::err_ovl_candidate);
+    NoteOverloadCandidate(RemainingMatches[I]);
   return 0;
 }
 
index a0904189161bf3f481f1d0b3be90be2d0fd6f878..34ce54665613b45743eecc95fb2394166309f6ff 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-struct Base { }; // expected-note{{candidate function}}
-struct Derived : Base { }; // expected-note{{candidate function}}
+struct Base { }; // expected-note{{candidate is the implicit copy constructor}}
+struct Derived : Base { }; // expected-note{{candidate is the implicit copy constructor}}
 struct Unrelated { };
 struct Derived2 : Base { };
 struct Diamond : Derived, Derived2 { };
index aa53ebc58025b822dcf2ec17170c4373c90e4cd3..6f23e78c1cc220f581159e68326190ba00b7b0a2 100644 (file)
@@ -14,7 +14,7 @@ struct InitOkay {
   InitOkay(int) { }
 };
 
-struct CannotInit { }; // expected-note{{candidate function}}
+struct CannotInit { }; // expected-note{{candidate is the implicit copy constructor}}
 
 int &returnInt() { return X<int>::value; }
 float &returnFloat() { return X<float>::value; }
index 3cefeb821e99afce573d653b333904db76424211..e281150241b372f3f2168682356d937a4d483d67 100644 (file)
@@ -12,7 +12,7 @@ struct X1 {
   X1(int);
 };
 
-struct X2 { }; // expected-note{{candidate function}}
+struct X2 { }; // expected-note{{candidate is the implicit copy constructor}}
 
 int& get_int() { return X0<int>::value; }
 X1& get_X1() { return X0<X1>::value; }
index 67d648ea97bbf929f96de5bd34c49f5b03dc1a80..a48702d662893cded81945ded1070ad286a559f2 100644 (file)
@@ -15,7 +15,7 @@ template<template<class T> class Y> struct X1 {
 // could be interpreted as either a non-type template-parameter or a
 // type-parameter (because its identifier is the name of an already
 // existing class) is taken as a type-parameter. For example, 
-class T { /* ... */ };  // expected-note{{candidate function}}
+class T { /* ... */ };  // expected-note{{candidate is the implicit copy constructor}}
 int i; 
 
 template<class T, T i> struct X2 {
index 6e7f80842ec043670cc598c9f7584235bf3a1f1a..a5ecf5fcd9d23b920a86187a0591088e937a46a9 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
 struct NonDefaultConstructible {
-  NonDefaultConstructible(const NonDefaultConstructible&); // expected-note{{candidate function}}
+  NonDefaultConstructible(const NonDefaultConstructible&); // expected-note{{candidate constructor}}
 };
 
 template<typename T, typename U>
index 3eaf89689a254e591eb5ef0be876ccb90e0713a9..29045cc86015fdeef4da8ae1e2e62582a6380c5f 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate function}}
-  IntHolder(int); // expected-note 2{{candidate function}}
+struct IntHolder { // expected-note{{here}} // expected-note 2{{candidate is the implicit copy constructor}}
+  IntHolder(int); // expected-note 2{{candidate constructor}}
 };
 
 template<typename T, typename U>
index 626bdf18150389c3ea5fe3766ee575c9b99e226f..eb729ff676d09fef31ae6109ddad3d49203d4a80 100644 (file)
@@ -48,8 +48,8 @@ template void X1<int>::f<>(int&, int*); // expected-note{{instantiation}}
 
 // Explicitly instantiate members of a class template
 struct Incomplete; // expected-note{{forward declaration}}
-struct NonDefaultConstructible { // expected-note{{candidate function}}
-  NonDefaultConstructible(int); // expected-note{{candidate function}}
+struct NonDefaultConstructible { // expected-note{{candidate is the implicit copy constructor}}
+  NonDefaultConstructible(int); // expected-note{{candidate constructor}}
 };
 
 template<typename T, typename U>
index a0b57e1baa53a38655c84a3282450972bac661bf..7931d11d14de962f39f366c2b81ab464d1a102c0 100644 (file)
@@ -16,8 +16,8 @@ void test() {
   for (;s;) ; // expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}}
   switch (s) {} // expected-error {{statement requires expression of integer type ('struct S' invalid)}}
 
-  while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} expected-note{{candidate function}}
-  while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}} expected-note{{candidate function}}
+  while (struct S {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct S' is not contextually convertible to 'bool'}} expected-note{{candidate is the implicit copy constructor}}
+  while (struct {} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{no viable conversion}} expected-error {{value of type 'struct <anonymous>' is not contextually convertible to 'bool'}} expected-note{{candidate is the implicit copy constructor}}
   switch (enum {E} x=0) ; // expected-error {{types may not be defined in conditions}} expected-error {{cannot initialize}}
 
   if (int x=0) { // expected-note 2 {{previous definition is here}}
index 67d4074cbcdc91ab36b2ed11cae93bf473027683..ecab4e47fda45d5a4499e93bab92f3ab7b3cb29d 100644 (file)
@@ -97,13 +97,10 @@ struct Current : Derived {
                                                   // expected-error {{member initializer 'NonExisting' does not name a non-static data member or}}
 };
 
-                        // FIXME. This is bad message!
-struct M {              // expected-note {{candidate function}} \
-                        // expected-note {{candidate function}} \
+struct M {              // expected-note 2 {{candidate is the implicit copy constructor}} \
                         // expected-note {{declared here}} \
                         // expected-note {{declared here}}
-  M(int i, int j);      // expected-note {{candidate function}} \
-                        // // expected-note {{candidate function}}
+  M(int i, int j);      // expected-note 2 {{candidate constructor}}
 };
 
 struct N : M  {
index db322f4a3d34e2797d0b7808b8b36da350b5907b..4fef172bd5a1a0095069f4fdce14850dd36d54f7 100644 (file)
@@ -56,9 +56,9 @@ public:
 
 // This used to crash Clang.
 struct Flip;
-struct Flop { // expected-note{{candidate function}}
+struct Flop { // expected-note{{candidate is the implicit copy constructor}}
   Flop();
-  Flop(const Flip&); // expected-note{{candidate function}}
+  Flop(const Flip&); // expected-note{{candidate constructor}}
 };
 struct Flip {
   operator Flop() const; // expected-note{{candidate function}}
index e78798b82cb76731ff3f3e8fb5be49c4f37aa1cf..3ef003ce76c8ad857ed6911d9ecaae1368d64d34 100644 (file)
@@ -27,7 +27,7 @@ public:
   FromShort(short s);
 };
 
-class FromShortExplicitly { // expected-note{{candidate function}}
+class FromShortExplicitly { // expected-note{{candidate is the implicit copy constructor}}
 public:
   explicit FromShortExplicitly(short s);
 };
index ad149232a4e369143d28779f1cf82cd9e708c8a6..2cf878a84411be7fb27d862b7b2548948bd08692 100644 (file)
@@ -2,7 +2,7 @@
 class X {
 public:
   explicit X(const X&);
-  X(int*); // expected-note 2{{candidate function}}
+  X(int*); // expected-note 2{{candidate constructor}}
   explicit X(float*);
 };
 
index 87b51e32e5cf3c44a8605563df81333f60be357d..f928626a03a57e3466afa7e4de79b8b9e7eb33a9 100644 (file)
@@ -40,9 +40,9 @@ char cv[4] = { 'a', 's', 'd', 'f', 0 }; // expected-error{{excess elements in ar
 struct TooFew { int a; char* b; int c; }; 
 TooFew too_few = { 1, "asdf" }; // okay
 
-struct NoDefaultConstructor { // expected-note 3 {{candidate function}} \
+struct NoDefaultConstructor { // expected-note 3 {{candidate is the implicit copy constructor}} \
                               // expected-note{{declared here}}
-  NoDefaultConstructor(int); // expected-note 3 {{candidate function}}
+  NoDefaultConstructor(int); // expected-note 3 {{candidate constructor}}
 };
 struct TooFewError { // expected-error{{implicit default constructor for}}
   int a;
@@ -115,7 +115,7 @@ B2 b2_2 = { 4, d2, 0 };
 B2 b2_3 = { c2, a2, a2 };
 
 // C++ [dcl.init.aggr]p15:
-union u { int a; char* b; }; // expected-note{{candidate function}}
+union u { int a; char* b; }; // expected-note{{candidate is the implicit copy constructor}}
 u u1 = { 1 }; 
 u u2 = u1; 
 u u3 = 1; // expected-error{{no viable conversion}}
index 294543f495dbd5afa20146e25a15e2600968241a..656f3436a0c3b87d5cb017b64c85cf3436d40137 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
 
-struct A {}; // expected-note {{candidate function}}
+struct A {}; // expected-note {{candidate is the implicit copy constructor}}
 
 struct BASE {
   operator A(); // expected-note {{candidate function}}
index 880255e4531b1005274743ce8287c0a5a161e384..d2c44bd998a0ecb17d050cda93aa10ce905f7b24 100644 (file)
@@ -82,7 +82,7 @@ int Y::mem4(int i = a) // expected-error{{invalid use of nonstatic data member '
 // constructors.
 class Z {
 public:
-  Z(Z&, int i = 17); // expected-note 3 {{candidate function}}
+  Z(Z&, int i = 17); // expected-note 3 {{candidate constructor}}
 
   void f(Z& z) { 
     Z z2;    // expected-error{{no matching constructor for initialization}}
@@ -103,7 +103,7 @@ struct ZZ {
 
   void f(ZZ z = g()); // expected-error{{no matching constructor for initialization}}
 
-  ZZ(ZZ&, int = 17); // expected-note{{candidate function}}
+  ZZ(ZZ&, int = 17); // expected-note{{candidate constructor}}
 };
 
 // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#325
index 03a5da3a303b2226e1dd3e9aa59c2f44e8ce3e12..bc1cde5827bb8ec5443b420035c9fbd1b6849a7d 100644 (file)
@@ -13,16 +13,16 @@ class Y {
   explicit Y(float);
 };
 
-class X { // expected-note{{candidate function}}
+class X { // expected-note{{candidate is the implicit copy constructor}}
 public:
-  explicit X(int); // expected-note{{candidate function}}
-  X(float, float, float); // expected-note{{candidate function}}
-  X(float, Y); // expected-note{{candidate function}}
+  explicit X(int); // expected-note{{candidate constructor}}
+  X(float, float, float); // expected-note{{candidate constructor}}
+  X(float, Y); // expected-note{{candidate constructor}}
 };
 
-class Z { // expected-note{{candidate function}}
+class Z { // expected-note{{candidate is the implicit copy constructor}}
 public:
-  Z(int); // expected-note{{candidate function}}
+  Z(int); // expected-note{{candidate constructor}}
 };
 
 void g() {
index 63be77008cb44efbe3291b3263fb1edeb54e482a..946d4713f7572c747bb7191044065e3ac23a98c2 100644 (file)
@@ -10,10 +10,8 @@ struct InitViaConstructor {
   InitViaConstructor(int i = 7);
 };
 
-// FIXME: error messages for implicitly-declared special member
-// function candidates are very poor
-struct NoValueInit { // expected-note 2 {{candidate function}} 
-  NoValueInit(int i, int j); // expected-note 2 {{candidate function}}
+struct NoValueInit { // expected-note 2 {{candidate is the implicit copy constructor}} 
+  NoValueInit(int i, int j); // expected-note 2 {{candidate constructor}}
 };
 
 void test_cxx_functional_value_init() {
index ab690b7286ec8fb3d710acce4bbbbf17ac9b08bf..38b31f721a23c7f1fc8304c0ccef2b204f64566d 100644 (file)
@@ -9,7 +9,7 @@ int A; // expected-error {{redefinition of 'A' as different kind of symbol}}
 class A; // expected-error {{redefinition of 'A' as different kind of symbol}}
 
 class B {}; // expected-note {{previous definition is here}} \
-            // FIXME: ugly expected-note{{candidate function}}
+            // expected-note{{candidate is the implicit copy assignment operator}}
 
 void C(); // expected-note {{previous definition is here}}
 namespace C {} // expected-error {{redefinition of 'C' as different kind of symbol}}
index 4e65b41e666c281a80fb90d38e1fa14af0a0acba..a53231dca70ad59c90ece09ad2a6d47a9412c748 100644 (file)
@@ -178,7 +178,7 @@ bool (foo_S::value);
 
 
 namespace somens {
-  struct a { }; // expected-note{{candidate function}}
+  struct a { }; // expected-note{{candidate is the implicit copy constructor}}
 }
 
 template <typename T>
index 12903cc7facf411dacb6283b03618dcd990fdaec..e9ffc2ad3f442514878029bc276e2c976b8f8c25 100644 (file)
@@ -59,7 +59,7 @@ void f(Short s, Long l, Enum1 e1, Enum2 e2, Xpmf pmf) {
   // FIXME: should pass (void)static_cast<no&>(islong(e1 % e2));
 }
 
-struct ShortRef { // expected-note{{candidate function}}
+struct ShortRef { // expected-note{{candidate is the implicit copy assignment operator}}
   operator short&();
 };
 
@@ -67,7 +67,7 @@ struct LongRef {
   operator volatile long&();
 };
 
-struct XpmfRef { // expected-note{{candidate function}}
+struct XpmfRef { // expected-note{{candidate is the implicit copy assignment operator}}
   operator pmf&();
 };
 
index 7ff3d584c02e6942f6776f25a631702f094d0b3f..1cde26352a67d5c660d9201c59c98f746e4fda98 100644 (file)
@@ -67,8 +67,8 @@ struct MoveOnly {
   MoveOnly();
   MoveOnly(const MoveOnly&) = delete;  // expected-note {{candidate function}} \
   // expected-note 3{{explicitly marked deleted here}}
-  MoveOnly(MoveOnly&&);        // expected-note {{candidate function}}
-  MoveOnly(int&&);     // expected-note {{candidate function}}
+  MoveOnly(MoveOnly&&);        // expected-note {{candidate constructor}}
+  MoveOnly(int&&);     // expected-note {{candidate constructor}}
 };
 
 MoveOnly gmo;
index 139de9d68605fea62904197c8ffaa922fd03628d..82c2aa4cc3e795c18f0ee2f5cbe95fbb51486e29 100644 (file)
@@ -52,8 +52,8 @@ template <> struct A<int>{A(const A<int>&);};
 struct B { A<int> x; B(B& a) : x(a.x) {} };
 
 struct X2 {
-  X2(); // expected-note{{candidate function}}
-  X2(X2&);     // expected-note {{candidate function}}
+  X2(); // expected-note{{candidate constructor}}
+  X2(X2&);     // expected-note {{candidate constructor}}
   template<typename T> X2(T);
 };
 
@@ -71,9 +71,9 @@ struct X3 {
 template<> X3::X3(X3); // expected-error{{must pass its first argument by reference}}
 
 struct X4 {
-  X4(); // expected-note{{candidate function}}
+  X4(); // expected-note{{candidate constructor}}
   ~X4();
-  X4(X4&);     // expected-note {{candidate function}}
+  X4(X4&);     // expected-note {{candidate constructor}}
   template<typename T> X4(const T&, int = 17);
 };
 
index 0edc504ea0a37f49d5cd110704631f1cac45638e..9ec2e9e0fe10bd8a654757f56a9acc4a4e2e6496 100644 (file)
@@ -5,7 +5,7 @@ class C { C(int a0 = 0); };
 template<>
 C<char>::C(int a0);
 
-struct S { }; // expected-note 3 {{candidate function}}
+struct S { }; // expected-note 3 {{candidate is the implicit copy constructor}}
 
 template<typename T> void f1(T a, T b = 10) { } // expected-error{{no viable conversion}}
 
index fbb5edbefd6c2b9907f30fb6820730fb41edce4c..c42ce26240e1bb8fa684fb84c5c702cda37c6f52 100644 (file)
@@ -25,8 +25,8 @@ T X0<T>::value; // expected-error{{no matching constructor}}
 
 template int X0<int>::value;
 
-struct NotDefaultConstructible { // expected-note{{candidate function}}
-  NotDefaultConstructible(int); // expected-note{{candidate function}}
+struct NotDefaultConstructible { // expected-note{{candidate is the implicit copy constructor}}
+  NotDefaultConstructible(int); // expected-note{{candidate constructor}}
 };
 
 template NotDefaultConstructible X0<NotDefaultConstructible>::value; // expected-note{{instantiation}}
index 0c2cf9c4f2e63e0711896122ff914133ee513799..b17a0faf7ca99a9f2d39ddfe7e9d173da32b8992 100644 (file)
@@ -8,7 +8,7 @@
 // Fake typeid, lacking a typeinfo header.
 namespace std { class type_info {}; }
 
-struct dummy {}; // expected-note 3 {{candidate function}}
+struct dummy {}; // expected-note 3 {{candidate is the implicit copy constructor}}
 
 template<typename T>
 int f0(T x) {
index c524e958f8a7747c5447b2cd6993b85775ce38ba..06fd2296c642d88b26753ba17e069523aa5fce41 100644 (file)
@@ -21,8 +21,8 @@ struct FunctionalCast0 {
 
 template struct FunctionalCast0<5>;
 
-struct X { // expected-note 3 {{candidate function}}
-  X(int, int); // expected-note 3 {{candidate function}}
+struct X { // expected-note 3 {{candidate is the implicit copy constructor}}
+  X(int, int); // expected-note 3 {{candidate constructor}}
 };
 
 template<int N, int M>
index 8a2f34d475a76270fd4a463d6309399c49c2a894..789fe3db872ee01ff2478f08a830ac0689b25138 100644 (file)
@@ -30,7 +30,7 @@ T Z<T>::value; // expected-error{{no matching constructor}}
 struct DefCon {};
 
 struct NoDefCon { 
-  NoDefCon(const NoDefCon&); // expected-note{{candidate function}}
+  NoDefCon(const NoDefCon&); // expected-note{{candidate constructor}}
 };
 
 void test() {