1 // RUN: %clang_cc1 -std=c++1z -verify %s
2 
3 struct A { int x, y; };
4 typedef int B[2];
5 struct C { template<int> int get(); };
6 struct D { int x, y, z; };
7 struct E { int *p, n; };
8 
9 namespace std {
10   using size_t = decltype(sizeof(0));
11   template<typename> struct tuple_size;
12   template<size_t, typename> struct tuple_element { using type = int; };
13 }
14 
15 template<> struct std::tuple_size<C> { enum { value = 2 }; };
16 
decomp(T & t)17 template<typename T> int decomp(T &t) {
18   auto &[a, b] = t; // expected-error {{type 'D' decomposes into 3 elements, but only 2 names were provided}}
19   return a + b; // expected-error {{cannot initialize return object of type 'int' with an rvalue of type 'int *'}}
20 }
21 
test()22 void test() {
23   A a;
24   B b;
25   C c;
26   D d;
27   E e;
28   decomp(a);
29   decomp(b);
30   decomp(c);
31   decomp(d); // expected-note {{in instantiation of}}
32   decomp(e); // expected-note {{in instantiation of}}
33 }
34