2 // { dg-options -std=c++17 }
4 #define assert(X) do { if (!(X)) __builtin_abort(); } while (0)
7 template<typename T> struct tuple_size;
8 template<int, typename> struct tuple_element;
13 template <int I> int& get() { return i; }
16 template<> struct std::tuple_size<A> { static const int value = 2; };
17 template<int I> struct std::tuple_element<I,A> { using type = int; };
22 template <int I> int& get(B&& b) { return b.i; }
23 template <int I> int& get(B& b) { return b.i; }
25 template<> struct std::tuple_size<B> { static const int value = 2; };
26 template<int I> struct std::tuple_element<I,B> { using type = int; };
33 assert (&x == &y && &x == &a.i && x == 42);
36 assert (&x2 == &y2 && &x2 != &a.i && x2 == 42);
42 assert (&x == &y && &x == &b.i && x == 42);
45 assert (&x2 == &y2 && &x2 != &b.i && x2 == 42);