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//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___UTILITY_DECLVAL_H
10#define _LIBCPP___UTILITY_DECLVAL_H
11
12#include <__config>
13#include <__type_traits/add_reference.h>
14
15#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16# pragma GCC system_header
17#endif
18
19_LIBCPP_BEGIN_NAMESPACE_STD
20
21// Suppress deprecation notice for volatile-qualified return type resulting
22// from volatile-qualified types _Tp.
23_LIBCPP_SUPPRESS_DEPRECATED_PUSH
24template <class _Tp>
25_LIBCPP_HIDE_FROM_ABI __add_rvalue_reference_t<_Tp> declval() _NOEXCEPT {
26 static_assert(false,
27 "std::declval can only be used in an unevaluated context. "
28 "It's likely that your current usage is trying to extract a value from the function.");
29}
30_LIBCPP_SUPPRESS_DEPRECATED_POP
31
32_LIBCPP_END_NAMESPACE_STD
33
34#endif // _LIBCPP___UTILITY_DECLVAL_H
35