[libcxx-commits] [libcxx] [libc++] Use availability to rely on key functions for bad_expected_access and bad_function_call (PR #87390)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 22 14:08:46 PDT 2024


================
@@ -0,0 +1,13 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include <expected>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; }
----------------
zibi2 wrote:

@ldionne Louis, I noticed out down stream build failing with 
```
libcxx/src/expected.cpp:12:13: error: no template named 'bad_expected_access'
   12 | const char* bad_expected_access<void>::what() const noexcept { return "bad access to std::expected"; }
      |             ^
```
Shouldn't this definition be guarded with `#if _LIBCPP_STD_VER >= 23` to match its declaratoin in `libcxx/include/__expected/bad_expected_access.h` header file? 

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


More information about the libcxx-commits mailing list