"call to %0 is ambiguous">;
def err_ovl_deleted_call : Error<
"call to %select{unavailable|deleted}0 function %1">;
+def err_ovl_unavailable_call : Error<
+ "call to unavailable function %0: %1">;
def err_ovl_ambiguous_member_call : Error<
"call to member function %0 is ambiguous">;
def err_ovl_deleted_member_call : Error<
break;
case OR_Deleted:
- Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_deleted_call)
- << Best->Function->isDeleted()
- << ULE->getName()
- << Fn->getSourceRange();
- CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, NumArgs);
+ {
+ llvm::StringRef Message;
+ if (const UnavailableAttr *UA =
+ Best->Function->getAttr<UnavailableAttr>())
+ Message = UA->getMessage();
+
+ if (Message.empty())
+ Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_deleted_call)
+ << Best->Function->isDeleted()
+ << ULE->getName()
+ << Fn->getSourceRange();
+ else
+ Diag(Fn->getSourceRange().getBegin(), diag::err_ovl_unavailable_call)
+ << ULE->getName()
+ << Message
+ << Fn->getSourceRange();
+ CandidateSet.NoteCandidates(*this, OCD_AllCandidates, Args, NumArgs);
+ }
break;
}
int &(*fp3)(int) = foo;
void (*fp4)(...) = foo; // expected-error{{'foo' is unavailable}}
}
+
+namespace radar9046492 {
+// rdar://9046492
+#define FOO __attribute__((unavailable("not available - replaced")))
+
+void foo() FOO; // expected-note {{candidate function has been explicitly made unavailable}}
+
+void bar() {
+ foo(); // expected-error {{call to unavailable function 'foo': not available - replaced}}
+}
+}