[clang] [Clang] Add [[clang::diagnose_specializations]] (PR #101469)
Nikolas Klauser via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 09:23:47 PDT 2024
================
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 %s -verify
+
+#if !__has_cpp_attribute(clang::diagnose_specializations)
+# error
+#endif
+
+struct [[clang::diagnose_specializations]] S {}; // expected-warning {{'diagnose_specializations' attribute only applies to class templates}}
+
+template <class T, class U>
+struct [[clang::diagnose_specializations]] is_same {
----------------
philnik777 wrote:
I guess we could add an optional string, but I'd actually keep the error message generic in libc++. IMO adding the stable name is more useful for us than for users. Maybe a bit stronger wording like `'X' cannot be specialized` would make sense.
https://github.com/llvm/llvm-project/pull/101469
More information about the cfe-commits
mailing list