Debian Codegraph @

libstdc++-v3/testsuite/20_util/common_reference/p2655r3.cc

raw
1 // P2655R3 - common_reference_t of reference_wrapper Should Be a Reference Type
2 // Implemented as a DR against C++20
3 // { dg-do compile { target c++20 } }
4
5 #include <type_traits>
6
7 #if __cpp_lib_common_reference != 202302L
8 # error "Feature-test macro __cpp_lib_common_reference has wrong value in <type_traits>"
9 #endif
10
11 struct A { };
12 struct B { operator A&() const; };
13
14 static_assert( std::is_same_v<std::common_reference_t<A&, const B&>, A&> );
15 static_assert( std::is_same_v<std::common_reference_t<const B&, A&>, A&> );