[libcxx-commits] [libcxx] [libcxx] Enrich message for std::bad_variant_access exception (PR #196495)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 17 09:33:22 PDT 2026
================
@@ -309,11 +322,11 @@ struct __farray {
_LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator[](size_t __n) const noexcept { return __buf_[__n]; }
};
-[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access() {
+[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_variant_access(const char* __msg) {
# if _LIBCPP_HAS_EXCEPTIONS
- throw bad_variant_access();
+ throw __bad_variant_access_with_msg(__msg);
----------------
philnik777 wrote:
https://eel.is/c++draft/conforming#res.on.exception.handling-1 gives us permission to throw a derived class.
https://github.com/llvm/llvm-project/pull/196495
More information about the libcxx-commits
mailing list