xref: /netbsd-src/external/apache2/llvm/dist/libcxx/src/optional.cpp (revision 4d6fc14bc9b0c5bf3e30be318c143ee82cadd108)
1*4d6fc14bSjoerg //===------------------------ optional.cpp --------------------------------===//
2*4d6fc14bSjoerg //
3*4d6fc14bSjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*4d6fc14bSjoerg // See https://llvm.org/LICENSE.txt for license information.
5*4d6fc14bSjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*4d6fc14bSjoerg //
7*4d6fc14bSjoerg //===----------------------------------------------------------------------===//
8*4d6fc14bSjoerg 
9*4d6fc14bSjoerg #include "optional"
10*4d6fc14bSjoerg #include "__availability"
11*4d6fc14bSjoerg 
12*4d6fc14bSjoerg namespace std
13*4d6fc14bSjoerg {
14*4d6fc14bSjoerg 
15*4d6fc14bSjoerg bad_optional_access::~bad_optional_access() noexcept = default;
16*4d6fc14bSjoerg 
what() const17*4d6fc14bSjoerg const char* bad_optional_access::what() const noexcept {
18*4d6fc14bSjoerg   return "bad_optional_access";
19*4d6fc14bSjoerg   }
20*4d6fc14bSjoerg 
21*4d6fc14bSjoerg } // std
22*4d6fc14bSjoerg 
23*4d6fc14bSjoerg 
24*4d6fc14bSjoerg #include <experimental/__config>
25*4d6fc14bSjoerg 
26*4d6fc14bSjoerg //  Preserve std::experimental::bad_optional_access for ABI compatibility
27*4d6fc14bSjoerg //  Even though it no longer exists in a header file
28*4d6fc14bSjoerg _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
29*4d6fc14bSjoerg 
30*4d6fc14bSjoerg class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
31*4d6fc14bSjoerg     : public std::logic_error
32*4d6fc14bSjoerg {
33*4d6fc14bSjoerg public:
bad_optional_access()34*4d6fc14bSjoerg 	bad_optional_access() : std::logic_error("Bad optional Access") {}
35*4d6fc14bSjoerg 
36*4d6fc14bSjoerg //	Get the key function ~bad_optional_access() into the dylib
37*4d6fc14bSjoerg     virtual ~bad_optional_access() noexcept;
38*4d6fc14bSjoerg };
39*4d6fc14bSjoerg 
40*4d6fc14bSjoerg bad_optional_access::~bad_optional_access() noexcept = default;
41*4d6fc14bSjoerg 
42*4d6fc14bSjoerg _LIBCPP_END_NAMESPACE_EXPERIMENTAL
43