[PATCH] D134180: [clang] Fix a nullptr-access crash in CheckTemplateArgument.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 19 10:21:11 PDT 2022
hokein added inline comments.
================
Comment at: clang/lib/Sema/SemaTemplate.cpp:6960
+ if (ParamType.isNull())
+ return ExprError();
// CheckNonTypeTemplateParameterType will produce a diagnostic if there's
----------------
adamcz wrote:
> So this can only happen when Result is TDK_AlreadyDiagnosed above, right? In that case, I would handle such case explicitly in the code above, like:
> if (Result == TDK_AlreadyDiagnosed) return ExprError();
> else if (Result != TDK_Success) { ... }
> Seems like it would be more readable.
>
> However, I am definitely not opposed to keeping this check here as well, in case there are other ways to get into this situation.
right. I think either of them works, switched to your version.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134180/new/
https://reviews.llvm.org/D134180
More information about the cfe-commits
mailing list