summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-18 21:56:37 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-18 21:56:37 +0000
commit171c45ab0c19bbd28cd335662c14bf0387c811d0 (patch)
treef91384ec5a11fde7148887bf569085cdaf57d851 /clang/lib/Sema/SemaDeclCXX.cpp
parent96207699013c52344b58c2a9a979c9ba7ac256b0 (diff)
downloadbcm5719-llvm-171c45ab0c19bbd28cd335662c14bf0387c811d0.tar.gz
bcm5719-llvm-171c45ab0c19bbd28cd335662c14bf0387c811d0.zip
Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and found an unavailable function: in this case, we actually error. Merge the checking of unavailable functions with the checking for deprecated functions. This unifies a bit of code, and makes sure that we're checking for unavailable functions in the right places. Also, this check can cause an error. We may, eventually, want an option to make "unavailable" warnings into errors. Implement much of the logic needed for C++0x deleted functions, which are effectively the same as "unavailable" functions (but always cause an error when referenced). However, we don't have the syntax to specify deleted functions yet :) llvm-svn: 64955
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 9d2e06df855..8dd409bd218 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1650,6 +1650,18 @@ Sema::PerformInitializationByConstructor(QualType ClassType,
Diag(Loc, diag::err_ovl_ambiguous_init) << ClassType << Range;
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
return 0;
+
+ case OR_Deleted:
+ if (InitEntity)
+ Diag(Loc, diag::err_ovl_deleted_init)
+ << Best->Function->isDeleted()
+ << InitEntity << Range;
+ else
+ Diag(Loc, diag::err_ovl_deleted_init)
+ << Best->Function->isDeleted()
+ << InitEntity << Range;
+ PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/true);
+ return 0;
}
return 0;
@@ -1736,8 +1748,12 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType,
if (Fn) {
// Since we're performing this reference-initialization for
// real, update the initializer with the resulting function.
- if (!ICS)
+ if (!ICS) {
+ if (DiagnoseUseOfDecl(Fn, Init->getSourceRange().getBegin()))
+ return true;
+
FixOverloadedFunctionReference(Init, Fn);
+ }
T2 = Fn->getType();
}
@@ -1864,7 +1880,9 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType,
return true;
case OR_No_Viable_Function:
- // There was no suitable conversion; continue with other checks.
+ case OR_Deleted:
+ // There was no suitable conversion, or we found a deleted
+ // conversion; continue with other checks.
break;
}
}
OpenPOWER on IntegriCloud