[cfe-commits] r92990 - in /cfe/trunk: lib/Sema/Sema.h lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaOverload.cpp test/Sema/overloadable.c test/SemaCXX/attr-unavailable.cpp test/SemaCXX/rval-references.cpp

John McCall rjmccall at apple.com
Thu Jan 7 20:41:41 PST 2010


Author: rjmccall
Date: Thu Jan  7 22:41:39 2010
New Revision: 92990

URL: http://llvm.org/viewvc/llvm-project?rev=92990&view=rev
Log:
Change the printing of OR_Deleted overload results to print all the candidates,
not just the viable ones.  This is reasonable because the most common use of
deleted functions is to exclude some implicit conversion during calls;  users
therefore will want to figure out why some other options were excluded.

Started sorting overload results.  Right now it just sorts by location in the
translation unit (after putting viable functions first), but we can do better than
that.

Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better
self-documentation.


Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/Sema/overloadable.c
    cfe/trunk/test/SemaCXX/attr-unavailable.cpp
    cfe/trunk/test/SemaCXX/rval-references.cpp

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Jan  7 22:41:39 2010
@@ -1028,10 +1028,20 @@
   OverloadingResult BestViableFunction(OverloadCandidateSet& CandidateSet,
                                        SourceLocation Loc,
                                        OverloadCandidateSet::iterator& Best);
+
+  enum OverloadCandidateDisplayKind {
+    /// Requests that all candidates be shown.  Viable candidates will
+    /// be printed first.
+    OCD_AllCandidates,
+
+    /// Requests that only viable candidates be shown.
+    OCD_ViableCandidates
+  };
   void PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
-                         bool OnlyViable,
-                         const char *Opc=0,
-                         SourceLocation Loc=SourceLocation());
+                               OverloadCandidateDisplayKind OCD,
+                               const char *Opc = 0,
+                               SourceLocation Loc = SourceLocation());
+
   void NoteOverloadCandidate(FunctionDecl *Fn);
 
   FunctionDecl *ResolveAddressOfOverloadedFunction(Expr *From, QualType ToType,

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Jan  7 22:41:39 2010
@@ -4193,7 +4193,7 @@
     else
       Diag(Loc, diag::err_ovl_no_viable_function_in_init)
         << ClassType << Range;
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     return 0;
 
   case OR_Ambiguous:
@@ -4201,7 +4201,7 @@
       Diag(Loc, diag::err_ovl_ambiguous_init) << InitEntity << Range;
     else
       Diag(Loc, diag::err_ovl_ambiguous_init) << ClassType << Range;
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates);
     return 0;
 
   case OR_Deleted:
@@ -4216,7 +4216,7 @@
         << Best->Function->isDeleted()
         << RD->getDeclName() << Range;
     }
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     return 0;
   }
 
@@ -4540,7 +4540,7 @@
       }
       Diag(DeclLoc, diag::err_ref_init_ambiguous) << DeclType << Init->getType()
             << Init->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+      PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates);
       return true;
 
     case OR_No_Viable_Function:

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Jan  7 22:41:39 2010
@@ -673,20 +673,20 @@
   case OR_No_Viable_Function:
     Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
       << Name << Range;
-    PrintOverloadCandidates(Candidates, /*OnlyViable=*/false);
+    PrintOverloadCandidates(Candidates, OCD_AllCandidates);
     return true;
 
   case OR_Ambiguous:
     Diag(StartLoc, diag::err_ovl_ambiguous_call)
       << Name << Range;
-    PrintOverloadCandidates(Candidates, /*OnlyViable=*/true);
+    PrintOverloadCandidates(Candidates, OCD_ViableCandidates);
     return true;
 
   case OR_Deleted:
     Diag(StartLoc, diag::err_ovl_deleted_call)
       << Best->Function->isDeleted()
       << Name << Range;
-    PrintOverloadCandidates(Candidates, /*OnlyViable=*/true);
+    PrintOverloadCandidates(Candidates, OCD_AllCandidates);
     return true;
   }
   assert(false && "Unreachable, bad result from BestViableFunction");

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Jan  7 22:41:39 2010
@@ -88,7 +88,7 @@
       S.Diag(Init->getSourceRange().getBegin(),
              diag::err_typecheck_convert_ambiguous)
             << DeclType << Init->getType() << Init->getSourceRange();
-      S.PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+      S.PrintOverloadCandidates(CandidateSet, Sema::OCD_AllCandidates);
       return true;
     }
     return false;
@@ -3010,14 +3010,14 @@
     S.Diag(Loc, diag::err_temp_copy_no_viable)
       << (int)Entity.getKind() << CurInitExpr->getType()
       << CurInitExpr->getSourceRange();
-    S.PrintOverloadCandidates(CandidateSet, false);
+    S.PrintOverloadCandidates(CandidateSet, Sema::OCD_AllCandidates);
     return S.ExprError();
       
   case OR_Ambiguous:
     S.Diag(Loc, diag::err_temp_copy_ambiguous)
       << (int)Entity.getKind() << CurInitExpr->getType()
       << CurInitExpr->getSourceRange();
-    S.PrintOverloadCandidates(CandidateSet, true);
+    S.PrintOverloadCandidates(CandidateSet, Sema::OCD_ViableCandidates);
     return S.ExprError();
     
   case OR_Deleted:
@@ -3432,14 +3432,14 @@
           << DestType << Args[0]->getType()
           << Args[0]->getSourceRange();
 
-      S.PrintOverloadCandidates(FailedCandidateSet, true);
+      S.PrintOverloadCandidates(FailedCandidateSet, Sema::OCD_ViableCandidates);
       break;
         
     case OR_No_Viable_Function:
       S.Diag(Kind.getLocation(), diag::err_typecheck_nonviable_condition)
         << Args[0]->getType() << DestType.getNonReferenceType()
         << Args[0]->getSourceRange();
-      S.PrintOverloadCandidates(FailedCandidateSet, false);
+      S.PrintOverloadCandidates(FailedCandidateSet, Sema::OCD_AllCandidates);
       break;
         
     case OR_Deleted: {
@@ -3541,13 +3541,14 @@
       case OR_Ambiguous:
         S.Diag(Kind.getLocation(), diag::err_ovl_ambiguous_init)
           << DestType << ArgsRange;
-        S.PrintOverloadCandidates(FailedCandidateSet, true);
+        S.PrintOverloadCandidates(FailedCandidateSet,
+                                  Sema::OCD_ViableCandidates);
         break;
         
       case OR_No_Viable_Function:
         S.Diag(Kind.getLocation(), diag::err_ovl_no_viable_function_in_init)
           << DestType << ArgsRange;
-        S.PrintOverloadCandidates(FailedCandidateSet, false);
+        S.PrintOverloadCandidates(FailedCandidateSet, Sema::OCD_AllCandidates);
         break;
         
       case OR_Deleted: {

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Jan  7 22:41:39 2010
@@ -1617,7 +1617,7 @@
     << From->getType() << ToType << From->getSourceRange();
   else
     return false;
-  PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+  PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
   return true;  
 }
 
@@ -4314,14 +4314,20 @@
 
 namespace {
 
+void NoteDeletedCandidate(Sema &S, OverloadCandidate *Cand) {
+}
+
 void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand) {
-  if (Cand->Function->isDeleted() ||
-      Cand->Function->getAttr<UnavailableAttr>()) {
-    // Deleted or "unavailable" function.
+  // Note deleted candidates, but only if they're viable.
+  if (Cand->Viable &&
+      (Cand->Function->isDeleted() ||
+       Cand->Function->hasAttr<UnavailableAttr>())) {
     S.Diag(Cand->Function->getLocation(), diag::note_ovl_candidate_deleted)
       << Cand->Function->isDeleted();
     return;
-  } else if (FunctionTemplateDecl *FunTmpl 
+  }
+
+  if (FunctionTemplateDecl *FunTmpl 
                = Cand->Function->getPrimaryTemplate()) {
     // Function template specialization
     // FIXME: Give a better reason!
@@ -4431,23 +4437,61 @@
   }
 }
 
+struct CompareOverloadCandidates {
+  SourceManager &SM;
+  CompareOverloadCandidates(SourceManager &SM) : SM(SM) {}
+
+  bool operator()(const OverloadCandidate *L,
+                  const OverloadCandidate *R) {
+    // Order first by viability.
+    if (L->Viable != R->Viable)
+      return L->Viable;
+
+    // Put declared functions first.
+    if (L->Function) {
+      if (!R->Function) return true;
+      return SM.isBeforeInTranslationUnit(L->Function->getLocation(),
+                                          R->Function->getLocation());
+    } else if (R->Function) return false;
+
+    // Then surrogates.
+    if (L->IsSurrogate) {
+      if (!R->IsSurrogate) return true;
+      return SM.isBeforeInTranslationUnit(L->Surrogate->getLocation(),
+                                          R->Surrogate->getLocation());
+    } else if (R->IsSurrogate) return false;
+
+    // And builtins just come in a jumble.
+    return false;
+  }
+};
+
 } // end anonymous namespace
 
 /// 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.
+/// set.
 void
 Sema::PrintOverloadCandidates(OverloadCandidateSet& CandidateSet,
-                              bool OnlyViable,
+                              OverloadCandidateDisplayKind OCD,
                               const char *Opc,
                               SourceLocation OpLoc) {
+  // Sort the candidates by viability and position.  Sorting directly would
+  // be prohibitive, so we make a set of pointers and sort those.
+  llvm::SmallVector<OverloadCandidate*, 32> Cands;
+  if (OCD == OCD_AllCandidates) Cands.reserve(CandidateSet.size());
+  for (OverloadCandidateSet::iterator Cand = CandidateSet.begin(),
+                                  LastCand = CandidateSet.end();
+       Cand != LastCand; ++Cand)
+    if (Cand->Viable || OCD == OCD_AllCandidates)
+      Cands.push_back(Cand);
+  std::sort(Cands.begin(), Cands.end(), CompareOverloadCandidates(SourceMgr));
+  
   bool ReportedNonViableOperator = false;
 
-  OverloadCandidateSet::iterator Cand = CandidateSet.begin(),
-                             LastCand = CandidateSet.end();
-  for (; Cand != LastCand; ++Cand) {
-    if (OnlyViable && !Cand->Viable)
-      continue;
+  llvm::SmallVectorImpl<OverloadCandidate*>::iterator I, E;
+  for (I = Cands.begin(), E = Cands.end(); I != E; ++I) {
+    OverloadCandidate *Cand = *I;
 
     if (Cand->Function)
       NoteFunctionCandidate(*this, Cand);
@@ -4457,14 +4501,13 @@
     // This a builtin candidate.  We do not, in general, want to list
     // every possible builtin candidate.
 
-    // If 'OnlyViable' is true, there were viable candidates.
-    // This must be one of them because of the header condition.  List it.
-    else if (OnlyViable)
+    // If this is a viable builtin, print it.
+    else if (Cand->Viable)
       NoteBuiltinOperatorCandidate(*this, Opc, OpLoc, Cand);
 
     // Otherwise, non-viability might be due to ambiguous user-defined
     // conversions.  Report them exactly once.
-    else if (!Cand->Viable && !ReportedNonViableOperator) {
+    else if (!ReportedNonViableOperator) {
       NoteAmbiguousUserConversions(*this, OpLoc, Cand);
       ReportedNonViableOperator = true;
     }
@@ -4975,13 +5018,13 @@
     Diag(Fn->getSourceRange().getBegin(),
          diag::err_ovl_no_viable_function_in_call)
       << ULE->getName() << Fn->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     break;
 
   case OR_Ambiguous:
     Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_ambiguous_call)
       << ULE->getName() << Fn->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates);
     break;
 
   case OR_Deleted:
@@ -4989,7 +5032,7 @@
       << Best->Function->isDeleted()
       << ULE->getName()
       << Fn->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     break;
   }
 
@@ -5144,7 +5187,7 @@
       Diag(OpLoc,  diag::err_ovl_ambiguous_oper)
           << UnaryOperator::getOpcodeStr(Opc)
           << Input->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true, 
+      PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates, 
                               UnaryOperator::getOpcodeStr(Opc), OpLoc);
       return ExprError();
 
@@ -5153,7 +5196,7 @@
         << Best->Function->isDeleted()
         << UnaryOperator::getOpcodeStr(Opc)
         << Input->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
       return ExprError();
     }
 
@@ -5360,7 +5403,7 @@
       assert(Result.isInvalid() && 
              "C++ binary operator overloading is missing candidates!");
       if (Result.isInvalid())
-        PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false, 
+        PrintOverloadCandidates(CandidateSet, OCD_AllCandidates,
                                 BinaryOperator::getOpcodeStr(Opc), OpLoc);
       return move(Result);
     }
@@ -5369,7 +5412,7 @@
       Diag(OpLoc,  diag::err_ovl_ambiguous_oper)
           << BinaryOperator::getOpcodeStr(Opc)
           << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true, 
+      PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates,
                               BinaryOperator::getOpcodeStr(Opc), OpLoc);
       return ExprError();
 
@@ -5378,7 +5421,7 @@
         << Best->Function->isDeleted()
         << BinaryOperator::getOpcodeStr(Opc)
         << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
       return ExprError();
     }
 
@@ -5488,7 +5531,7 @@
         Diag(LLoc, diag::err_ovl_no_viable_subscript)
           << Args[0]->getType()
           << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false,
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates,
                               "[]", LLoc);
       return ExprError();
     }
@@ -5496,7 +5539,7 @@
     case OR_Ambiguous:
       Diag(LLoc,  diag::err_ovl_ambiguous_oper)
           << "[]" << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true,
+      PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates,
                               "[]", LLoc);
       return ExprError();
 
@@ -5504,7 +5547,8 @@
       Diag(LLoc, diag::err_ovl_deleted_oper)
         << Best->Function->isDeleted() << "[]"
         << Args[0]->getSourceRange() << Args[1]->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates,
+                              "[]", LLoc);
       return ExprError();
     }
 
@@ -5588,14 +5632,14 @@
       Diag(UnresExpr->getMemberLoc(),
            diag::err_ovl_no_viable_member_function_in_call)
         << DeclName << MemExprE->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
       // FIXME: Leaking incoming expressions!
       return ExprError();
 
     case OR_Ambiguous:
       Diag(UnresExpr->getMemberLoc(), diag::err_ovl_ambiguous_member_call)
         << DeclName << MemExprE->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
       // FIXME: Leaking incoming expressions!
       return ExprError();
 
@@ -5603,7 +5647,7 @@
       Diag(UnresExpr->getMemberLoc(), diag::err_ovl_deleted_member_call)
         << Best->Function->isDeleted()
         << DeclName << MemExprE->getSourceRange();
-      PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+      PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
       // FIXME: Leaking incoming expressions!
       return ExprError();
     }
@@ -5752,14 +5796,14 @@
       Diag(Object->getSourceRange().getBegin(),
            diag::err_ovl_no_viable_object_call)
         << Object->getType() << Object->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     break;
 
   case OR_Ambiguous:
     Diag(Object->getSourceRange().getBegin(),
          diag::err_ovl_ambiguous_object_call)
       << Object->getType() << Object->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates);
     break;
 
   case OR_Deleted:
@@ -5767,7 +5811,7 @@
          diag::err_ovl_deleted_object_call)
       << Best->Function->isDeleted()
       << Object->getType() << Object->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     break;
   }
 
@@ -5948,20 +5992,20 @@
     else
       Diag(OpLoc, diag::err_ovl_no_viable_oper)
         << "operator->" << Base->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     return ExprError();
 
   case OR_Ambiguous:
     Diag(OpLoc,  diag::err_ovl_ambiguous_oper)
       << "->" << Base->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_ViableCandidates);
     return ExprError();
 
   case OR_Deleted:
     Diag(OpLoc,  diag::err_ovl_deleted_oper)
       << Best->Function->isDeleted()
       << "->" << Base->getSourceRange();
-    PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+    PrintOverloadCandidates(CandidateSet, OCD_AllCandidates);
     return ExprError();
   }
 

Modified: cfe/trunk/test/Sema/overloadable.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/overloadable.c?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/test/Sema/overloadable.c (original)
+++ cfe/trunk/test/Sema/overloadable.c Thu Jan  7 22:41:39 2010
@@ -37,9 +37,9 @@
 
 double *f(int) __attribute__((overloadable)); // expected-error{{conflicting types for 'f'}}
 
-double promote(float) __attribute__((__overloadable__));
-double promote(double) __attribute__((__overloadable__));
-long double promote(long double) __attribute__((__overloadable__));
+double promote(float) __attribute__((__overloadable__)); // expected-note {{candidate}}
+double promote(double) __attribute__((__overloadable__)); // expected-note {{candidate}}
+long double promote(long double) __attribute__((__overloadable__)); // expected-note {{candidate}}
 
 void promote() __attribute__((__overloadable__)); // expected-error{{'overloadable' function 'promote' must have a prototype}}
 void promote(...) __attribute__((__overloadable__, __unavailable__)); // \

Modified: cfe/trunk/test/SemaCXX/attr-unavailable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-unavailable.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/attr-unavailable.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-unavailable.cpp Thu Jan  7 22:41:39 2010
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-int &foo(int);
-double &foo(double);
+int &foo(int); // expected-note {{candidate}}
+double &foo(double); // expected-note {{candidate}}
 void foo(...) __attribute__((__unavailable__)); // expected-note {{candidate function}} \
 // expected-note{{function has been explicitly marked unavailable here}}
 

Modified: cfe/trunk/test/SemaCXX/rval-references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/rval-references.cpp?rev=92990&r1=92989&r2=92990&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/rval-references.cpp (original)
+++ cfe/trunk/test/SemaCXX/rval-references.cpp Thu Jan  7 22:41:39 2010
@@ -65,7 +65,7 @@
 // Test the return dance. This also tests IsReturnCopyElidable.
 struct MoveOnly {
   MoveOnly();
-  MoveOnly(const MoveOnly&) = delete;	// expected-note {{candidate function}} \
+  MoveOnly(const MoveOnly&) = delete;	// expected-note {{candidate constructor}} \
   // expected-note 3{{explicitly marked deleted here}}
   MoveOnly(MoveOnly&&);	// expected-note {{candidate constructor}}
   MoveOnly(int&&);	// expected-note {{candidate constructor}}





More information about the cfe-commits mailing list