Skip to content

Commit 73e8e1b

Browse files
committed
[libc++][NFC] Qualify declval
While it's not necessary to qualify calls to `declval` it makes error messages very crypric if the declaration isn't reachable anymore For example: ``` /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:53:66: error: no type named 'type' in 'std::common_type<long, long>' typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:107:14: note: in instantiation of template class 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>, std::chrono::duration<long, std::ratio<3600, 1>>>' requested here : public common_type<_Tp, _Tp> {}; ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:279:58: note: in instantiation of template class 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>>' requested here _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);} ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:308:54: note: in instantiation of template class 'std::chrono::duration<long, std::ratio<3600, 1>>' requested here typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days; ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:280:81: error: no type named 'type' in 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>>' _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:308:54: note: in instantiation of template class 'std::chrono::duration<long, std::ratio<3600, 1>>' requested here typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days; ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:53:66: error: no type named 'type' in 'std::common_type<int, int>' typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:107:14: note: in instantiation of template class 'std::common_type<std::chrono::duration<int, std::ratio<86400, 1>>, std::chrono::duration<int, std::ratio<86400, 1>>>' requested here : public common_type<_Tp, _Tp> {}; ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:279:58: note: in instantiation of template class 'std::common_type<std::chrono::duration<int, std::ratio<86400, 1>>>' requested here _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);} ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:309:55: note: in instantiation of template class 'std::chrono::duration<int, std::ratio<86400, 1>>' requested here typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks; ^ 19 similar errors omitted ``` changes with qualification added to: ``` While building module 'std' imported from /home/nikolask/llvm-projects/libcxx/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp:13: In file included from <module-includes>:17: In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/math.h:309: In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/limits:107: In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/type_traits:432: In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_reference.h:13: /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:28:43: error: declaration of 'declval' must be imported from module 'std.utility.__utility.declval' before it is required using __cond_type = decltype(false ? std::declval<_Tp>() : std::declval<_Up>()); ^ /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__utility/declval.h:30:34: note: declaration here is not visible decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT; ^ /home/nikolask/llvm-projects/libcxx/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp:13:10: fatal error: could not build module 'std' #include <functional> ~~~~~~~~^ 2 errors generated. ``` Reviewed By: ldionne, Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D130854
1 parent edba5d5 commit 73e8e1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+172
-118
lines changed

libcxx/include/__algorithm/comp_ref_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ struct __debug_less
4949
template <class _LHS, class _RHS>
5050
_LIBCPP_CONSTEXPR_SINCE_CXX14
5151
inline _LIBCPP_INLINE_VISIBILITY
52-
decltype((void)declval<_Compare&>()(
53-
declval<_LHS &>(), declval<_RHS &>()))
52+
decltype((void)std::declval<_Compare&>()(
53+
std::declval<_LHS &>(), std::declval<_RHS &>()))
5454
__do_compare_assert(int, _LHS & __l, _RHS & __r) {
5555
_LIBCPP_DEBUG_ASSERT(!__comp_(__l, __r),
5656
"Comparator does not induce a strict weak ordering");

libcxx/include/__algorithm/iter_swap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ template <class _ForwardIterator1, class _ForwardIterator2>
2323
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void iter_swap(_ForwardIterator1 __a,
2424
_ForwardIterator2 __b)
2525
// _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b)))
26-
_NOEXCEPT_(_NOEXCEPT_(swap(*declval<_ForwardIterator1>(), *declval<_ForwardIterator2>()))) {
26+
_NOEXCEPT_(_NOEXCEPT_(swap(*std::declval<_ForwardIterator1>(), *std::declval<_ForwardIterator2>()))) {
2727
swap(*__a, *__b);
2828
}
2929

libcxx/include/__compare/compare_three_way_result.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result { };
2626

2727
template<class _Tp, class _Up>
2828
struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result<_Tp, _Up, decltype(
29-
declval<__make_const_lvalue_ref<_Tp>>() <=> declval<__make_const_lvalue_ref<_Up>>(), void()
29+
std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void()
3030
)> {
31-
using type = decltype(declval<__make_const_lvalue_ref<_Tp>>() <=> declval<__make_const_lvalue_ref<_Up>>());
31+
using type = decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>());
3232
};
3333

3434
template<class _Tp, class _Up = _Tp>

libcxx/include/__compare/synth_three_way.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way =
4242
};
4343

4444
template <class _Tp, class _Up = _Tp>
45-
using __synth_three_way_result = decltype(std::__synth_three_way(declval<_Tp&>(), declval<_Up&>()));
45+
using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>()));
4646

4747
#endif // _LIBCPP_STD_VER > 17
4848

libcxx/include/__concepts/common_with.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ template<class _Tp, class _Up>
3131
concept common_with =
3232
same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> &&
3333
requires {
34-
static_cast<common_type_t<_Tp, _Up>>(declval<_Tp>());
35-
static_cast<common_type_t<_Tp, _Up>>(declval<_Up>());
34+
static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>());
35+
static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>());
3636
} &&
3737
common_reference_with<
3838
add_lvalue_reference_t<const _Tp>,

libcxx/include/__concepts/convertible_to.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ template<class _From, class _To>
2727
concept convertible_to =
2828
is_convertible_v<_From, _To> &&
2929
requires {
30-
static_cast<_To>(declval<_From>());
30+
static_cast<_To>(std::declval<_From>());
3131
};
3232

3333
#endif // _LIBCPP_STD_VER > 17

libcxx/include/__format/format_arg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class __basic_format_arg_value {
161161
using _Dp = remove_cvref_t<_Tp>;
162162
using _Formatter = typename _Context::template formatter_type<_Dp>;
163163
constexpr bool __const_formattable =
164-
requires { _Formatter().format(declval<const _Dp&>(), declval<_Context&>()); };
164+
requires { _Formatter().format(std::declval<const _Dp&>(), std::declval<_Context&>()); };
165165
using _Qp = conditional_t<__const_formattable, const _Dp, _Dp>;
166166

167167
static_assert(__const_formattable || !is_const_v<remove_reference_t<_Tp>>, "Mandated by [format.arg]/18");

libcxx/include/__functional/invoke.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ template <class _Ret, class _Fp, class ..._Args>
398398
struct __invokable_r
399399
{
400400
template <class _XFp, class ..._XArgs>
401-
static decltype(std::__invoke(declval<_XFp>(), declval<_XArgs>()...)) __try_call(int);
401+
static decltype(std::__invoke(std::declval<_XFp>(), std::declval<_XArgs>()...)) __try_call(int);
402402
template <class _XFp, class ..._XArgs>
403403
static __nat __try_call(...);
404404

@@ -432,7 +432,7 @@ struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
432432
static const bool value = false;
433433
#else
434434
static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(
435-
_VSTD::__invoke(declval<_Fp>(), declval<_Args>()...)));
435+
_VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...)));
436436
#endif
437437
};
438438

@@ -443,7 +443,7 @@ struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
443443
static const bool value = false;
444444
#else
445445
static const bool value = noexcept(
446-
_VSTD::__invoke(declval<_Fp>(), declval<_Args>()...));
446+
_VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...));
447447
#endif
448448
};
449449

libcxx/include/__functional/reference_wrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class _LIBCPP_TEMPLATE_VIS reference_wrapper : public __weak_result_type<_Tp>
3838
static void __fun(_Tp&&) = delete;
3939

4040
public:
41-
template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(declval<_Up>())) > >
41+
template <class _Up, class = __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, decltype(__fun(std::declval<_Up>())) > >
4242
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
43-
reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(declval<_Up>()))) {
43+
reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
4444
type& __f = static_cast<_Up&&>(__u);
4545
__f_ = _VSTD::addressof(__f);
4646
}

libcxx/include/__functional/weak_result_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
286286
template <class _Tp, class ..._Args>
287287
struct __invoke_return
288288
{
289-
typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
289+
typedef decltype(_VSTD::__invoke(std::declval<_Tp>(), std::declval<_Args>()...)) type;
290290
};
291291

292292
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__iterator/advance.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void __advance(_RandIter& __i, typename iterator_traits<_RandIter>::difference_t
5858

5959
template <
6060
class _InputIter, class _Distance,
61-
class _IntegralDistance = decltype(_VSTD::__convert_to_integral(declval<_Distance>())),
61+
class _IntegralDistance = decltype(_VSTD::__convert_to_integral(std::declval<_Distance>())),
6262
class = __enable_if_t<is_integral<_IntegralDistance>::value> >
6363
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
6464
void advance(_InputIter& __i, _Distance __orig_n) {

libcxx/include/__iterator/common_iterator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class common_iterator {
217217
}
218218

219219
_LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& __i)
220-
noexcept(noexcept(ranges::iter_move(declval<const _Iter&>())))
220+
noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
221221
requires input_iterator<_Iter>
222222
{
223223
_LIBCPP_ASSERT(std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator");
@@ -226,7 +226,7 @@ class common_iterator {
226226

227227
template<indirectly_swappable<_Iter> _I2, class _S2>
228228
_LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y)
229-
noexcept(noexcept(ranges::iter_swap(declval<const _Iter&>(), declval<const _I2&>())))
229+
noexcept(noexcept(ranges::iter_swap(std::declval<const _Iter&>(), std::declval<const _I2&>())))
230230
{
231231
_LIBCPP_ASSERT(std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
232232
_LIBCPP_ASSERT(std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator");
@@ -257,7 +257,7 @@ struct __arrow_type_or_void {
257257
template<class _Iter, class _Sent>
258258
requires __common_iter_has_ptr_op<_Iter, _Sent>
259259
struct __arrow_type_or_void<_Iter, _Sent> {
260-
using type = decltype(declval<const common_iterator<_Iter, _Sent>&>().operator->());
260+
using type = decltype(std::declval<const common_iterator<_Iter, _Sent>&>().operator->());
261261
};
262262

263263
template<input_iterator _Iter, class _Sent>

libcxx/include/__iterator/incrementable_traits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ concept __has_integral_minus =
5757
template<__has_integral_minus _Tp>
5858
requires (!__has_member_difference_type<_Tp>)
5959
struct incrementable_traits<_Tp> {
60-
using difference_type = make_signed_t<decltype(declval<_Tp>() - declval<_Tp>())>;
60+
using difference_type = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>;
6161
};
6262

6363
template <class>

libcxx/include/__iterator/iter_move.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ inline namespace __cpo {
9595

9696
template<__dereferenceable _Tp>
9797
requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; }
98-
using iter_rvalue_reference_t = decltype(ranges::iter_move(declval<_Tp&>()));
98+
using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>()));
9999

100100
#endif // _LIBCPP_STD_VER > 17
101101

libcxx/include/__iterator/iter_swap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ namespace __iter_swap {
8282
constexpr void operator()(_T1&& __x, _T2&& __y) const
8383
noexcept(noexcept(iter_value_t<_T2>(ranges::iter_move(__y))) &&
8484
noexcept(*__y = ranges::iter_move(__x)) &&
85-
noexcept(*_VSTD::forward<_T1>(__x) = declval<iter_value_t<_T2>>()))
85+
noexcept(*_VSTD::forward<_T1>(__x) = std::declval<iter_value_t<_T2>>()))
8686
{
8787
iter_value_t<_T2> __old(ranges::iter_move(__y));
8888
*__y = ranges::iter_move(__x);

libcxx/include/__iterator/iterator_traits.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ concept __dereferenceable = requires(_Tp& __t) {
6060

6161
// [iterator.traits]
6262
template<__dereferenceable _Tp>
63-
using iter_reference_t = decltype(*declval<_Tp&>());
63+
using iter_reference_t = decltype(*std::declval<_Tp&>());
6464

6565
#endif // _LIBCPP_STD_VER > 17
6666

@@ -273,7 +273,7 @@ struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { using type = typ
273273
template<class _Ip>
274274
requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>)
275275
struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> {
276-
using type = decltype(declval<_Ip&>().operator->());
276+
using type = decltype(std::declval<_Ip&>().operator->());
277277
};
278278

279279
// Otherwise, `reference` names `iter-reference-t<I>`.

libcxx/include/__iterator/move_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct __move_iter_category_base<_Iter> {
5353

5454
template<class _Iter, class _Sent>
5555
concept __move_iter_comparable = requires {
56-
{ declval<const _Iter&>() == declval<_Sent>() } -> convertible_to<bool>;
56+
{ std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>;
5757
};
5858
#endif // _LIBCPP_STD_VER > 17
5959

libcxx/include/__iterator/reverse_iterator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
184184
_LIBCPP_HIDE_FROM_ABI friend constexpr
185185
iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i)
186186
noexcept(is_nothrow_copy_constructible_v<_Iter> &&
187-
noexcept(ranges::iter_move(--declval<_Iter&>()))) {
187+
noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
188188
auto __tmp = __i.base();
189189
return ranges::iter_move(--__tmp);
190190
}
@@ -194,7 +194,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
194194
void iter_swap(const reverse_iterator& __x, const reverse_iterator<_Iter2>& __y)
195195
noexcept(is_nothrow_copy_constructible_v<_Iter> &&
196196
is_nothrow_copy_constructible_v<_Iter2> &&
197-
noexcept(ranges::iter_swap(--declval<_Iter&>(), --declval<_Iter2&>()))) {
197+
noexcept(ranges::iter_swap(--std::declval<_Iter&>(), --std::declval<_Iter2&>()))) {
198198
auto __xtmp = __x.base();
199199
auto __ytmp = __y.base();
200200
ranges::iter_swap(--__xtmp, --__ytmp);
@@ -401,7 +401,7 @@ class __unconstrained_reverse_iterator {
401401
_LIBCPP_HIDE_FROM_ABI friend constexpr
402402
iter_rvalue_reference_t<_Iter> iter_move(const __unconstrained_reverse_iterator& __i)
403403
noexcept(is_nothrow_copy_constructible_v<_Iter> &&
404-
noexcept(ranges::iter_move(--declval<_Iter&>()))) {
404+
noexcept(ranges::iter_move(--std::declval<_Iter&>()))) {
405405
auto __tmp = __i.base();
406406
return ranges::iter_move(--__tmp);
407407
}

libcxx/include/__memory/allocator_traits.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ struct __has_allocate_hint : false_type { };
187187

188188
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
189189
struct __has_allocate_hint<_Alloc, _SizeType, _ConstVoidPtr, decltype(
190-
(void)declval<_Alloc>().allocate(declval<_SizeType>(), declval<_ConstVoidPtr>())
190+
(void)std::declval<_Alloc>().allocate(std::declval<_SizeType>(), std::declval<_ConstVoidPtr>())
191191
)> : true_type { };
192192

193193
// __has_construct
@@ -196,7 +196,7 @@ struct __has_construct_impl : false_type { };
196196

197197
template <class _Alloc, class ..._Args>
198198
struct __has_construct_impl<decltype(
199-
(void)declval<_Alloc>().construct(declval<_Args>()...)
199+
(void)std::declval<_Alloc>().construct(std::declval<_Args>()...)
200200
), _Alloc, _Args...> : true_type { };
201201

202202
template <class _Alloc, class ..._Args>
@@ -208,7 +208,7 @@ struct __has_destroy : false_type { };
208208

209209
template <class _Alloc, class _Pointer>
210210
struct __has_destroy<_Alloc, _Pointer, decltype(
211-
(void)declval<_Alloc>().destroy(declval<_Pointer>())
211+
(void)std::declval<_Alloc>().destroy(std::declval<_Pointer>())
212212
)> : true_type { };
213213

214214
// __has_max_size
@@ -217,7 +217,7 @@ struct __has_max_size : false_type { };
217217

218218
template <class _Alloc>
219219
struct __has_max_size<_Alloc, decltype(
220-
(void)declval<_Alloc&>().max_size()
220+
(void)std::declval<_Alloc&>().max_size()
221221
)> : true_type { };
222222

223223
// __has_select_on_container_copy_construction
@@ -226,7 +226,7 @@ struct __has_select_on_container_copy_construction : false_type { };
226226

227227
template <class _Alloc>
228228
struct __has_select_on_container_copy_construction<_Alloc, decltype(
229-
(void)declval<_Alloc>().select_on_container_copy_construction()
229+
(void)std::declval<_Alloc>().select_on_container_copy_construction()
230230
)> : true_type { };
231231

232232
_LIBCPP_SUPPRESS_DEPRECATED_POP

libcxx/include/__memory/construct_at.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3232

3333
#if _LIBCPP_STD_VER > 17
3434

35-
template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))>
35+
template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
3636
_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) {
3737
_LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at");
3838
return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...);
3939
}
4040

4141
#endif
4242

43-
template <class _Tp, class... _Args, class = decltype(::new(declval<void*>()) _Tp(declval<_Args>()...))>
43+
template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))>
4444
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Args&&... __args) {
4545
#if _LIBCPP_STD_VER > 17
4646
return std::construct_at(__location, std::forward<_Args>(__args)...);

libcxx/include/__memory/pointer_traits.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ struct _HasToAddress : false_type {};
179179

180180
template <class _Pointer>
181181
struct _HasToAddress<_Pointer,
182-
decltype((void)pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))
182+
decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
183183
> : true_type {};
184184

185185
template <class _Pointer, class = void>
186186
struct _HasArrow : false_type {};
187187

188188
template <class _Pointer>
189189
struct _HasArrow<_Pointer,
190-
decltype((void)declval<const _Pointer&>().operator->())
190+
decltype((void)std::declval<const _Pointer&>().operator->())
191191
> : true_type {};
192192

193193
template <class _Pointer>
@@ -200,24 +200,24 @@ template <class _Pointer, class = __enable_if_t<
200200
_And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
201201
> >
202202
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
203-
typename decay<decltype(__to_address_helper<_Pointer>::__call(declval<const _Pointer&>()))>::type
203+
typename decay<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>::type
204204
__to_address(const _Pointer& __p) _NOEXCEPT {
205205
return __to_address_helper<_Pointer>::__call(__p);
206206
}
207207

208208
template <class _Pointer, class>
209209
struct __to_address_helper {
210210
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
211-
static decltype(_VSTD::__to_address(declval<const _Pointer&>().operator->()))
211+
static decltype(_VSTD::__to_address(std::declval<const _Pointer&>().operator->()))
212212
__call(const _Pointer& __p) _NOEXCEPT {
213213
return _VSTD::__to_address(__p.operator->());
214214
}
215215
};
216216

217217
template <class _Pointer>
218-
struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))> {
218+
struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> {
219219
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
220-
static decltype(pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))
220+
static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))
221221
__call(const _Pointer& __p) _NOEXCEPT {
222222
return pointer_traits<_Pointer>::to_address(__p);
223223
}

libcxx/include/__memory/ranges_construct_at.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace __construct_at {
3939

4040
struct __fn {
4141
template<class _Tp, class... _Args, class = decltype(
42-
::new (declval<void*>()) _Tp(declval<_Args>()...)
42+
::new (std::declval<void*>()) _Tp(std::declval<_Args>()...)
4343
)>
4444
_LIBCPP_HIDE_FROM_ABI
4545
constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const {

libcxx/include/__memory/shared_ptr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ struct __compatible_with
366366
template <class _Ptr, class = void>
367367
struct __is_deletable : false_type { };
368368
template <class _Ptr>
369-
struct __is_deletable<_Ptr, decltype(delete declval<_Ptr>())> : true_type { };
369+
struct __is_deletable<_Ptr, decltype(delete std::declval<_Ptr>())> : true_type { };
370370

371371
template <class _Ptr, class = void>
372372
struct __is_array_deletable : false_type { };
373373
template <class _Ptr>
374-
struct __is_array_deletable<_Ptr, decltype(delete[] declval<_Ptr>())> : true_type { };
374+
struct __is_array_deletable<_Ptr, decltype(delete[] std::declval<_Ptr>())> : true_type { };
375375

376376
template <class _Dp, class _Pt,
377-
class = decltype(declval<_Dp>()(declval<_Pt>()))>
377+
class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))>
378378
static true_type __well_formed_deleter_test(int);
379379

380380
template <class, class>

libcxx/include/__random/is_valid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ template<> struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {};
5353
template<class, class = void> struct __libcpp_random_is_valid_urng : false_type {};
5454
template<class _Gp> struct __libcpp_random_is_valid_urng<_Gp, __enable_if_t<
5555
is_unsigned<typename _Gp::result_type>::value &&
56-
_IsSame<decltype(declval<_Gp&>()()), typename _Gp::result_type>::value
56+
_IsSame<decltype(std::declval<_Gp&>()()), typename _Gp::result_type>::value
5757
> > : true_type {};
5858

5959
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__ranges/access.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ inline namespace __cpo {
105105

106106
namespace ranges {
107107
template <class _Tp>
108-
using iterator_t = decltype(ranges::begin(declval<_Tp&>()));
108+
using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
109109
} // namespace ranges
110110

111111
// [range.access.end]

libcxx/include/__ranges/all.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ inline namespace __cpo {
7373
} // namespace __cpo
7474

7575
template<ranges::viewable_range _Range>
76-
using all_t = decltype(views::all(declval<_Range>()));
76+
using all_t = decltype(views::all(std::declval<_Range>()));
7777

7878
} // namespace ranges::views
7979

0 commit comments

Comments
 (0)