Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for looking into this, that's a rather amusing bug.
| clang/lib/Sema/SemaDeclCXX.cpp | ||
|---|---|---|
| 3398–3399 | No need to look at isInstField, it's already tested above on line 3365. | |
| clang/test/SemaCXX/class.cpp | ||
| 219 | Can you also add test cases for: static int k<12>; void f<12>(); To make sure we diagnose it the same way, both in a non-template class and within a templated class. | |
- Fix redundant check
- move test to p17.cpp which seems more approriate
- add a couple of tests
Do we have a test somewhere to check the variable template specialization case to make sure that didn't break? Otherwise LGTM.
Thanks for the review.
It seems fairly well covered in clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp
LGTM (I'm a bit sad about the diagnostic differences, but I understand why they're different a bit better now, so this is fine.)
clang-format: please reformat the code
- if(isInstField && D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { - Diag(D.getIdentifierLoc(), diag::err_member_with_template_arguments) - << II - << SourceRange(D.getName().TemplateId->LAngleLoc, D.getName().TemplateId->RAngleLoc) - << D.getName().TemplateId->LAngleLoc; + if (isInstField && + D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { + Diag(D.getIdentifierLoc(), diag::err_member_with_template_arguments) + << II + << SourceRange(D.getName().TemplateId->LAngleLoc,2 diff lines are omitted. See full path.