[PATCH] D133609: [Sema] compat warning of using deduced type in non-type template parameter
Matheus Izvekov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 9 14:07:29 PDT 2022
mizvekov added inline comments.
================
Comment at: clang/lib/Sema/SemaTemplate.cpp:1535-1545
+ if (TInfo->getType()->getContainedAutoType()) {
+ // template<auto xx>
+ Diag(D.getIdentifierLoc(),
+ diag::warn_cxx14_compat_template_nontype_parm_auto_type)
+ << QualType(TInfo->getType()->getContainedAutoType(), 0);
+ } else {
+ // template<DeducedClass dc>
----------------
This largely duplicates the effort from D132990
Your patch will also fix the crash fixed by D132990, and I even suggested there also handling deduced template specializations.
Two points about this change though:
* The new diagnosticis too generic and does not explain what the user did wrong.
* Please test for each case of AutoType and DeducedTemplateSpecializationType explicitly, and llvm_unreachable on anything else, so that when a new kind of DeducedType is added, we handle it with an appropriate message. This goes with the first bullet, if you know what each case is, you can produce more explanatory diagnostics.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133609/new/
https://reviews.llvm.org/D133609
More information about the cfe-commits
mailing list