File tree Expand file tree Collapse file tree
libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111// template<class T>
1212// constexpr T& as-lvalue(T&& t) { // exposition only
1313
14- #include < concepts>
14+ #include < cassert>
15+ #include < type_traits>
1516#include < utility>
1617
17- constexpr bool test () {
18- // Check glvalue
19- {
20- int lvalue{};
21- [[maybe_unused]] std::same_as<int &> decltype (auto ) check = std::__as_lvalue (lvalue);
22- }
18+ constexpr bool test (int value = 0 ) {
19+ static_assert (std::is_same<decltype (std::__as_lvalue (value)), int &>::value, " " );
20+ static_assert (std::is_same<decltype (std::__as_lvalue (std::move (value))), int &>::value, " " );
2321
24- // Check xvalue
25- {
26- int xvalue{};
27- [[maybe_unused]] std::same_as<int &> decltype (auto ) check = std::__as_lvalue (std::move (xvalue));
28- }
29-
30- return true ;
22+ return (assert (&std::__as_lvalue (value) == &value), assert (&std::__as_lvalue (std::move (value)) == &value), true );
3123}
3224
3325int main (int , char **) {
3426 test ();
35- static_assert (test ());
27+ static_assert (test (), " " );
3628
3729 return 0 ;
3830}
You can’t perform that action at this time.
0 commit comments