[libcxx-commits] [libcxx] [libc++][NFC] Refactor __libcpp_datasizeof to be a variable template (PR #87769)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 5 09:57:39 PDT 2024


================
@@ -26,39 +26,38 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-template <class _Tp>
-struct __libcpp_datasizeof {
 #if __has_extension(datasizeof)
-  static const size_t value = __datasizeof(_Tp);
+template <class _Tp>
+inline const size_t __datasizeof_v = __datasizeof(_Tp);
----------------
EricWF wrote:

What about the cost to the linker here? 

This is now external linkage with ODR deduplication?

Are we sure we don't ODR use this anywhere?

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


More information about the libcxx-commits mailing list