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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to