summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-03 19:09:14 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-03 19:09:14 +0000
commit2fe9883a961dfa872b0a20e8b56e7bf65fc98b6f (patch)
tree531be31c1fde3c0c9659e1c677968dd8da52dced /clang/lib/Sema/SemaDeclCXX.cpp
parent4d0549e3be84ae5645c1d6f4745c276e5bb69289 (diff)
downloadbcm5719-llvm-2fe9883a961dfa872b0a20e8b56e7bf65fc98b6f.tar.gz
bcm5719-llvm-2fe9883a961dfa872b0a20e8b56e7bf65fc98b6f.zip
Standard conversion sequences now have a CopyConstructor field, to
cope with the case where a user-defined conversion is actually a copy construction, and therefore can be compared against other standard conversion sequences. While I called this a hack before, now I'm convinced that it's the right way to go. Compare overloads based on derived-to-base conversions that invoke copy constructors. Suppress user-defined conversions when attempting to call a user-defined conversion. llvm-svn: 58629
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 703522321a3..1100e700c93 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -931,9 +931,13 @@ Sema::CompareReferenceRelationship(QualType T1, QualType T2,
/// errors are found. Either way, a return value of true indicates
/// that there was a failure, a return value of false indicates that
/// the reference initialization succeeded.
+///
+/// When @p SuppressUserConversions, user-defined conversions are
+/// suppressed.
bool
Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType,
- ImplicitConversionSequence *ICS) {
+ ImplicitConversionSequence *ICS,
+ bool SuppressUserConversions) {
assert(DeclType->isReferenceType() && "Reference init needs a reference");
QualType T1 = DeclType->getAsReferenceType()->getPointeeType();
@@ -1114,7 +1118,7 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType,
/// the argument expression. Any difference in top-level
/// cv-qualification is subsumed by the initialization itself
/// and does not constitute a conversion.
- *ICS = TryImplicitConversion(Init, T1);
+ *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions);
return ICS->ConversionKind == ImplicitConversionSequence::BadConversion;
} else {
return PerformImplicitConversion(Init, T1);
OpenPOWER on IntegriCloud