Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CXX / dcl.decl / dcl.decomp / p2.cpp
blobcad7d8e89ce0ff857cbc6f08c35d0ac60dc7e2fe
1 // RUN: %clang_cc1 -std=c++1z -verify %s -Wpedantic
3 struct X {
4 X(int);
5 X(const X&) = delete;
6 };
8 int array() {
9 static int arr[3] = {};
10 auto [a, b, c] = arr;
11 static_assert(&a != &arr[0]);
13 using I3 = int[3];
14 auto [a2, b2, c2] = I3{1, 2, 3};
16 using X3 = X[3];
17 auto [a3, b3, c3] = X3{1, 2, 3};
19 auto &[d, e] = arr; // expected-error {{type 'int[3]' decomposes into 3 elements, but only 2 names were provided}}
20 auto &[f, g, h, i] = arr; // expected-error {{type 'int[3]' decomposes into 3 elements, but 4 names were provided}}
22 auto &[r0, r1, r2] = arr;
23 const auto &[cr0, cr1, cr2] = arr;
25 static_assert(&arr[0] == &r0);
26 static_assert(&arr[0] == &cr0);
28 using T = int;
29 using T = decltype(r0);
30 using U = const int;
31 using U = decltype(cr0);
33 return r1 + cr2;