"types may not be defined in conditions">;
def err_typecheck_bool_condition : Error<
"value of type %0 is not contextually convertible to 'bool'">;
-def err_typecheck_ambiguous_bool_condition : Error<
- "conversion from %0 to 'bool' is ambiguous">;
+def err_typecheck_ambiguous_condition : Error<
+ "conversion from %0 to %1 is ambiguous">;
def err_expected_class_or_namespace : Error<"expected a class or namespace">;
def err_invalid_declarator_scope : Error<
"definition or redeclaration of %0 not in a namespace enclosing %1">;
if (!PerformImplicitConversion(From, ToType, Flavor,
/*AllowExplicit=*/false, Elidable))
return false;
-
- return Diag(From->getSourceRange().getBegin(),
- diag::err_typecheck_convert_incompatible)
- << ToType << From->getType() << Flavor << From->getSourceRange();
+ ImplicitConversionSequence ICS;
+ OverloadCandidateSet CandidateSet;
+ if (IsUserDefinedConversion(From, ToType, ICS.UserDefined,
+ CandidateSet,
+ true, false, false) != OR_Ambiguous)
+ return Diag(From->getSourceRange().getBegin(),
+ diag::err_typecheck_convert_incompatible)
+ << ToType << From->getType() << Flavor << From->getSourceRange();
+ Diag(From->getSourceRange().getBegin(),
+ diag::err_typecheck_ambiguous_condition)
+ << From->getType() << ToType << From->getSourceRange();
+ PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
+ return true;
}
/// TryObjectArgumentInitialization - Try to initialize the object
OverloadCandidateSet CandidateSet;
if (IsUserDefinedConversion(From, Context.BoolTy, ICS.UserDefined,
CandidateSet,
- true, true, false) != OR_Ambiguous)
+ true, false, false) != OR_Ambiguous)
return Diag(From->getSourceRange().getBegin(),
diag::err_typecheck_bool_condition)
<< From->getType() << From->getSourceRange();
Diag(From->getSourceRange().getBegin(),
- diag::err_typecheck_ambiguous_bool_condition)
- << From->getType() << From->getSourceRange();
+ diag::err_typecheck_ambiguous_condition)
+ << From->getType() << Context.BoolTy << From->getSourceRange();
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
return true;
}