Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/decomp-decltype1.C

raw
1 // PR c++/81176
2 // { dg-do compile { target c++17 } }
3
4 namespace std {
5 template<typename T> struct tuple_size;
6 template<int, typename> struct tuple_element;
7 }
8
9 struct A {
10 int i;
11 template <int I> int& get() { return i; }
12 };
13
14 template<> struct std::tuple_size<A> { static const int value = 2; };
15 template<int I> struct std::tuple_element<I,A> { using type = int; };
16
17 template <class,class> struct same_type;
18 template <class T> struct same_type<T,T> {};
19
20 void
21 foo (A x)
22 {
23 auto [ a, b ] = x;
24 decltype(auto) c = a;
25 same_type<decltype(a), int>{};
26 same_type<decltype(c), int>{};
27 }
28