aaron.ballman added a comment. Thanks for looking into this, that's a rather amusing bug.
================ Comment at: clang/lib/Sema/SemaDeclCXX.cpp:3398-3399 + if (isInstField && + D.getName().getKind() == UnqualifiedIdKind::IK_TemplateId) { + Diag(D.getIdentifierLoc(), diag::err_member_with_template_arguments) ---------------- No need to look at `isInstField`, it's already tested above on line 3365. ================ Comment at: clang/test/SemaCXX/class.cpp:219 +struct S { + int i<0>; // expected-error {{member 'i' cannot have template arguments}} + int j<int>; // expected-error {{member 'j' cannot have template arguments}} ---------------- 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. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120881/new/ https://reviews.llvm.org/D120881 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits