[PATCH] D156728: [Sema] Ignore nullability qualifiers when deducing types for `auto` and `__auto_type`

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 12:36:48 PDT 2023


ahatanak added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplateDeduction.cpp:3885
     ParamType = ParamType.getUnqualifiedType();
+    (void)AttributedType::stripOuterNullability(ParamType);
+  }
----------------
This isn't needed to fix the test cases I added, but I think the nullability qualifiers should be stripped here regardless.


================
Comment at: clang/test/SemaCXX/nullability.cpp:150
+  int * _Nonnull c = b; // OK.
+  foo(ptr); // _Nullable on ptr is ignored when T's type is deduced.
+}
----------------
Note that the template parameter for `foo` is correctly deduced (i.e., `_Nullable` is ignored) without this patch.


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