[clang] [Clang] Add [[clang::diagnose_specializations]] (PR #101469)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 10 04:01:10 PDT 2024


================
@@ -5408,7 +5408,10 @@ def note_dependent_function_template_spec_discard_reason : Note<
   "not a member of the enclosing %select{class template|"
   "namespace; did you mean to explicitly qualify the specialization?}1}0">;
 def warn_invalid_specialization : Warning<
-  "%0 should not be specialized">,
+  "%0 cannot be specialized">,
----------------
MitalAshok wrote:

```suggestion
  "%0 cannot be specialized%select{|: %2}1">,
```

And then change the diagnostics to `Diag(Loc, diag::warn_invalid_specialization) << VarOrClassTemplate << !Message.empty() << Message;`

https://github.com/llvm/llvm-project/pull/101469


More information about the cfe-commits mailing list