xref: /llvm-project/libc/src/__support/CPP/type_traits/always_false.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- convenient static_assert(false) helper ------------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
10 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
11 
12 #include "src/__support/macros/attributes.h"
13 #include "src/__support/macros/config.h"
14 
15 namespace LIBC_NAMESPACE_DECL {
16 namespace cpp {
17 
18 // This is technically not part of the standard but it come often enough that
19 // it's convenient to have around.
20 //
21 // https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2593r0.html#valid-workaround
22 //
23 // This will be fixed in C++23 according to [CWG
24 // 2518](https://cplusplus.github.io/CWG/issues/2518.html).
25 
26 // Usage `static_assert(cpp::always_false<T>, "error message");`
27 template <typename...> LIBC_INLINE_VAR constexpr bool always_false = false;
28 
29 } // namespace cpp
30 } // namespace LIBC_NAMESPACE_DECL
31 
32 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H
33