[Xtensa] Implement Windowed Register Option. (#124656)
[llvm-project.git] / libcxx / include / __new / launder.h
blob83d80015913d964456b133e33245ee709cc0999f
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___NEW_LAUNDER_H
10 #define _LIBCPP___NEW_LAUNDER_H
12 #include <__config>
13 #include <__type_traits/is_function.h>
14 #include <__type_traits/is_void.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
18 #endif
20 _LIBCPP_BEGIN_NAMESPACE_STD
21 template <class _Tp>
22 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT {
23 static_assert(!(is_function<_Tp>::value), "can't launder functions");
24 static_assert(!is_void<_Tp>::value, "can't launder cv-void");
25 return __builtin_launder(__p);
28 #if _LIBCPP_STD_VER >= 17
29 template <class _Tp>
30 [[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept {
31 return std::__launder(__p);
33 #endif
34 _LIBCPP_END_NAMESPACE_STD
36 #endif // _LIBCPP___NEW_LAUNDER_H