[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
Tue May 26 02:54:38 PDT 2026


================
@@ -292,6 +292,19 @@ public:
   [[__nodiscard__]] const char* what() const _NOEXCEPT override;
 };
 
+class _LIBCPP_EXPORTED_FROM_ABI __bad_variant_access_with_msg : public bad_variant_access {
+public:
+  _LIBCPP_HIDE_FROM_ABI explicit __bad_variant_access_with_msg(const char* __msg) _NOEXCEPT : __msg_(__msg) {}
+#  if _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_KEY_FUNCTION
----------------
philnik777 wrote:

```suggestion
#  if _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION
```

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


More information about the libcxx-commits mailing list