[PATCH] D156728: [Sema] Ignore nullability qualifiers when deducing types for `auto` and `__auto_type`
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 4 05:01:37 PDT 2023
gribozavr2 added inline comments.
================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3933
// type are ignored for type deduction.
+ // Ignore top level nullability qualifiers too.
ArgType = ArgType.getUnqualifiedType();
----------------
ahatanak wrote:
> gribozavr2 wrote:
> > This comment merely duplicates the code. Please add an explanation why it is done.
> I guess we were dropping the nullability qualifiers for the same reason we drop cv qualifiers. The new variable declared with `auto` is a separate variable, so it doesn't inherit the qualifiers the argument type.
>
> Of course, I'm assuming that's the rule we want, but I'm not sure as nullability qualifiers aren't part of the C/C++ standards.
> I guess we were dropping the nullability qualifiers for the same reason we drop cv qualifiers.
I don't think that argument applies. If the null dereference warning was flow sensitive, we would want to do exactly the opposite - that is, preserve nullability qualifiers during deduction.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156728/new/
https://reviews.llvm.org/D156728
More information about the cfe-commits
mailing list