[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
Thu Sep 1 18:03:12 PDT 2022
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);
}
----------------
shafik wrote:
> shafik wrote:
> > mizvekov wrote:
> > > 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.
> > I am not sure about the `DeducedTemplateSpecializationType` I was looking at the change that brought in that type and it is not clear to me what a good test would be. I believe outside of C++17 mode they would be hard errors. Can you provide an example that would work outside of C++17 mode?
> The `DeducedTemplateSpecializationType` also feels a bit outside the bug I am fixing so I might just choose to address it in a follow-up.
Well the bit on your test below, which you marked with no diagnostic expected, is an example.
This is something that works on C++20 but not on C++17, which is what this warning is supposed to warn, right?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132990/new/
https://reviews.llvm.org/D132990
More information about the cfe-commits
mailing list