[clang] [clang][Diagnostic] Clarify error message for auto (PR #149781)
Emily Dror via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 07:20:30 PDT 2025
================
@@ -8237,12 +8237,24 @@ Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) {
if (CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Ctx)) {
// C++ [temp.mem]p2:
// A local class shall not have member templates.
- if (RD->isLocalClass())
- return Diag(TemplateParams->getTemplateLoc(),
- diag::err_template_inside_local_class)
- << TemplateParams->getSourceRange();
- else
- return false;
+ if (RD->isLocalClass()) {
+ SourceLocation DiagLoc = TemplateParams->getTemplateLoc();
----------------
emily-dror wrote:
Good catch, thanks for the review. Would you direct me to the documentation for writing test cases?
> Also: we need a test for this. A simple reproducer that uses //expected-error lines that point to a line instead of 'in general' i think will work.
https://github.com/llvm/llvm-project/pull/149781
More information about the cfe-commits
mailing list