First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.
Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58071 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9f27f8d..ecc8e24 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1774,17 +1774,10 @@
// C++ 5.17p3: If the left operand is not of class type, the
// expression is implicitly converted (C++ 4) to the
// cv-unqualified type of the left operand.
- ImplicitConversionSequence ICS
- = TryCopyInitialization(rExpr, lhsType.getUnqualifiedType());
- if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
- // No implicit conversion available; we cannot perform this
- // assignment.
+ if (PerformImplicitConversion(rExpr, lhsType.getUnqualifiedType()))
return Incompatible;
- } else {
- // Perform the appropriate cast to the right-handle side.
- ImpCastExprToType(rExpr, lhsType.getUnqualifiedType());
+ else
return Compatible;
- }
}
// FIXME: Currently, we fall through and treat C++ classes like C