[PATCH] D132990: [Clang] Fix compat diagnostic to detect a nontype template parameter has a placeholder type using getContainedAutoType()

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 02:19:23 PDT 2022


mizvekov added a reviewer: mizvekov.
mizvekov added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:1534-1538
+  if (TInfo->getType()->getContainedAutoType()) {
     Diag(D.getIdentifierLoc(),
          diag::warn_cxx14_compat_template_nontype_parm_auto_type)
       << QualType(TInfo->getType()->getContainedAutoType(), 0);
   }
----------------
I think checking that the deduced type is undeduced was really unnecessary though, as I don't think we update the type source infos after deduction in any case.


================
Comment at: clang/test/SemaTemplate/temp_arg_nontype_diagnostic_cxx1z.cpp:7
+
+template <TemplateClass nttp> // ok, no diagnostic expected
+void func() {}
----------------
I think this should have a new diagnostic per above, as this is not compatible with C++17.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132990/new/

https://reviews.llvm.org/D132990



More information about the cfe-commits mailing list