[gcn] install.texi: Update for new ISA targets and their requirements
[gcc.git] / gcc / testsuite / g++.dg / cpp23 / elision6.C
blob5d58da9e57730815e413d0fdd7458ca87741b118
1 // PR c++/101165 - P2266R1 - Simpler implicit move
2 // { dg-do compile { target c++23 } }
3 // From [diff.cpp20.expr].
5 template<typename T, typename U>
6 struct same_type { static const bool value = false; };
8 template<typename T>
9 struct same_type<T, T> { static const bool value = true; };
11 // In C++23, returns int&&; previously returned int&.
12 decltype(auto) f(int&& x) { return (x); }
13 static_assert(same_type<decltype(f), int&& (int&&)>::value);
15 // This used to work in C++20.
16 int& g(int&& x) { return x; } // { dg-error "cannot bind non-const lvalue reference" }
18 template<typename T>
19 decltype(auto) h(T&& x) { return (x); }
20 static_assert(same_type<decltype(h(42)), int&&>::value);