================
@@ -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 {
----------------
ldionne wrote:
Would it make sense to allow passing a string (maybe optionally) to explain why
the template shouldn't be specialized? Then from libc++ we would do:
```
#define _LIBCPP_NO_SPECIALIZATION [[_Clang::__diagnose_specializations__("Per
<section> of the C++ Standard, users are not allowed to specialize class
templates in namespace std")]]
```
https://github.com/llvm/llvm-project/pull/101469
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits