[libc-commits] [libc] [llvm] [mlir] [libcxx] [lldb] [libcxxabi] [polly] [flang] [libunwind] [compiler-rt] [clang] [clang-tools-extra] [libc++][any] LWG3305: `any_cast<void>` (PR #78215)
    Mark de Wever via libc-commits 
    libc-commits at lists.llvm.org
       
    Fri Jan 19 08:58:57 PST 2024
    
    
  
================
@@ -555,6 +556,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
 
 template <class _ValueType>
 inline _LIBCPP_HIDE_FROM_ABI add_pointer_t<add_const_t<_ValueType>> any_cast(any const* __any) _NOEXCEPT {
+  static_assert(!is_void_v<_ValueType>, "_ValueType may not be void.");
----------------
mordante wrote:
Personally I dislike static assert message that are same as the test. In C++17 the message is optional. However since the existing code already has these messages I'm fine to keep them.
https://github.com/llvm/llvm-project/pull/78215
    
    
More information about the libc-commits
mailing list