[clang] [clang][Sema] Fix assertion in `tryDiagnoseOverloadedCast` (PR #108021)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 19:06:41 PDT 2024
================
@@ -446,7 +446,12 @@ static bool tryDiagnoseOverloadedCast(Sema &S, CastType CT,
: InitializationKind::CreateCast(/*type range?*/ range);
InitializationSequence sequence(S, entity, initKind, src);
- assert(sequence.Failed() && "initialization succeeded on second try?");
+ // It could happen that a constructor failed to be used because
+ // it requires a temporary of a broken type. Still, it will be found when
+ // looking for a match.
+ if (!sequence.Failed())
----------------
shafik wrote:
Does this mean that `destType->containsErrors()` is true? Perhaps both should be true otherwise assert?
https://github.com/llvm/llvm-project/pull/108021
More information about the cfe-commits
mailing list