aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprCXX.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
commit225c41eb3e960fd2e1d1b547f0f19a278d608bc5 (patch)
treeaf6555cae069fe2e89a6fa956ef044ffb8723ca8 /lib/Sema/SemaExprCXX.cpp
parent396b7cd9f6b35d87d17ae03e9448b5c1f2184598 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r--lib/Sema/SemaExprCXX.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 99b0829593..fde28529b7 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -929,6 +929,13 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
// anything here.
QualType FromType = From->getType();
+ if (SCS.CopyConstructor) {
+ // FIXME: Create a temporary object by calling the copy
+ // constructor.
+ ImpCastExprToType(From, ToType);
+ return false;
+ }
+
// Perform the first implicit conversion.
switch (SCS.First) {
case ICK_Identity:
@@ -982,13 +989,6 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
ImpCastExprToType(From, FromType);
break;
- case ICK_Derived_To_Base:
- // FIXME: This should never happen. It's a consequence of
- // pretending that a user-defined conversion via copy constructor
- // is actually a standard conversion.
- ImpCastExprToType(From, ToType);
- break;
-
default:
assert(false && "Improper second standard conversion");
break;