[libcxx-commits] [libcxx] [libc++] Use [[clang::no_specializations]] to diagnose invalid user specializations (PR #118167)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 8 08:07:45 PST 2025


================
@@ -1172,6 +1172,12 @@ typedef __char32_t char32_t;
 
 #  define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]]
 
+#  if __has_cpp_attribute(_Clang::__no_specializations__)
+#    define _LIBCPP_NO_SPECIALIZATIONS [[_Clang::__no_specializations__]]
----------------
ldionne wrote:

What would you think of `[[_Clang::__no_specializations__("Users are not allowed to specialize this entity in the Standard Library")]]`? People who do this kind of stuff are far from language lawyers, and the default message `"this cannot be specialized"` may be confusing for some.

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


More information about the libcxx-commits mailing list