While matching a non-type template argument against a known template
type parameter we now modify the AST's TemplateArgumentLoc to assume the
user wrote typename. Under -fms-compatibility, we downgrade our
diagnostic from an error to an extwarn.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
3115 ↗ | (On Diff #10193) | This diagnostic text isn't going to work well with -fms-extensions -pedantic-errors. Maybe phrase this more similarly to the existing cases: "template argument for template type parameter must be a type; omitted 'typename' is a Microsoft extension" (I'm also not convinced that we should call this a "Microsoft extension", but I can live with it.) |
lib/Sema/SemaExpr.cpp | ||
2196 ↗ | (On Diff #10193) | Our policy for fixits is to only put them on errors/warnings if we recover as if the fixit were applied (this is important for -fixit behavior). Either remove the fixit for now or move it to a note. |
lib/Sema/SemaTemplate.cpp | ||
5921–5923 ↗ | (On Diff #10193) | This comment doesn't look quite right: we don't get here for references to a template-id. We might have an explicit instantiation or an explicit or partial specialization, but the one thing we *don't* have is an implicit instantiation. This would also make more sense down next to Converted. |
include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
3115 ↗ | (On Diff #10193) | I was trying to make the diagnostic more concise, but I can put it back. I think I understand the issue with -pedantic-errors. Is it that we shouldn't make the diagnostic sound like we recovered if it gets upgraded from an ExtWarn to an error? I agree that "Microsoft extension" is maybe not the best way to describe these types of warnings, but it's consistent with every other -Wmicrosoft diagnostic. |
lib/Sema/SemaExpr.cpp | ||
2196 ↗ | (On Diff #10193) | OK, I'll remove the fixit. The recovery was unnecessary because now we recover prior to instantiation. |
lib/Sema/SemaTemplate.cpp | ||
5921–5923 ↗ | (On Diff #10193) | Woops, this should be reverted. I wrote this when I was half-way through understanding the problem. |