From 909b0778b5b51e1f1899c493dd0c8078851c2868 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Wed, 29 Jan 2025 14:55:05 +0000 Subject: [PATCH] Fix issues with `bad_expected` SMF --- .../cuda/std/__expected/bad_expected_access.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libcudacxx/include/cuda/std/__expected/bad_expected_access.h b/libcudacxx/include/cuda/std/__expected/bad_expected_access.h index 36e407c93bc..75766ada689 100644 --- a/libcudacxx/include/cuda/std/__expected/bad_expected_access.h +++ b/libcudacxx/include/cuda/std/__expected/bad_expected_access.h @@ -51,14 +51,6 @@ class bad_expected_access; template <> class bad_expected_access : public ::std::exception { -protected: - _CCCL_HIDE_FROM_ABI bad_expected_access() noexcept = default; - _CCCL_HIDE_FROM_ABI bad_expected_access(const bad_expected_access&) = default; - _CCCL_HIDE_FROM_ABI bad_expected_access(bad_expected_access&&) = default; - _CCCL_HIDE_FROM_ABI bad_expected_access& operator=(const bad_expected_access&) = default; - _CCCL_HIDE_FROM_ABI bad_expected_access& operator=(bad_expected_access&&) = default; - _CCCL_HIDE_FROM_ABI virtual ~bad_expected_access() noexcept override = default; - public: // The way this has been designed (by using a class template below) means that we'll already // have a profusion of these vtables in TUs, and the dynamic linker will already have a bunch @@ -74,10 +66,15 @@ template class bad_expected_access : public bad_expected_access { public: - explicit bad_expected_access(_Err __e) + _LIBCUDACXX_HIDE_FROM_ABI explicit bad_expected_access(_Err __e) : __unex_(_CUDA_VSTD::move(__e)) {} + _CCCL_HIDE_FROM_ABI ~bad_expected_access() noexcept + { + __unex_.~_Err(); + } + _LIBCUDACXX_HIDE_FROM_ABI _Err& error() & noexcept { return __unex_;