1- // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare"
1+ // RUN: %clang_cc1 -std=c++23 - emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare"
22
33// CHECK: define {{.*}} i32 @_Z1fv
44// CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(),
1717// CHECK: #dbg_declare(ptr %k, ![[VAR_7:[0-9]+]], !DIExpression()
1818// CHECK: #dbg_declare(ptr %v, ![[VAR_8:[0-9]+]], !DIExpression()
1919// CHECK: #dbg_declare(ptr %w, ![[VAR_9:[0-9]+]], !DIExpression()
20+ // CHECK: #dbg_declare(ptr %m, ![[VAR_10:[0-9]+]], !DIExpression()
21+ // CHECK: #dbg_declare(ptr %n, ![[VAR_11:[0-9]+]], !DIExpression()
22+ // CHECK: #dbg_declare(ptr %s, ![[VAR_12:[0-9]+]], !DIExpression()
23+ // CHECK: #dbg_declare(ptr %p, ![[VAR_13:[0-9]+]], !DIExpression()
2024// CHECK: ![[VAR_0]] = !DILocalVariable(name: "a"
2125// CHECK: ![[VAR_1]] = !DILocalVariable(name: "x1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2226// CHECK: ![[VAR_2]] = !DILocalVariable(name: "y1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2731// CHECK: ![[VAR_7]] = !DILocalVariable(name: "k", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2832// CHECK: ![[VAR_8]] = !DILocalVariable(name: "v", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2933// CHECK: ![[VAR_9]] = !DILocalVariable(name: "w", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
34+ // CHECK: ![[VAR_10]] = !DILocalVariable(name: "m", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
35+ // CHECK: ![[VAR_11]] = !DILocalVariable(name: "n", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
36+ // CHECK: ![[VAR_12]] = !DILocalVariable(name: "s", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
37+ // CHECK: ![[VAR_13]] = !DILocalVariable(name: "p", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
3038
3139struct A {
3240 int x;
@@ -41,6 +49,22 @@ struct B {
4149 template <> int get<1 >() { return z; }
4250};
4351
52+ struct C {
53+ int w;
54+ int z;
55+ template <int > int get (this C&& self);
56+ template <> int get<0 >(this C&& self) { return self.w ; }
57+ template <> int get<1 >(this C&& self) { return self.z ; }
58+ };
59+
60+ struct D {
61+ int w;
62+ int z;
63+ template <int > int get (int unused = 0 );
64+ template <> int get<0 >(int unused) { return w; }
65+ template <> int get<1 >(int unused) { return z; }
66+ };
67+
4468// Note: the following declarations are necessary for decomposition of tuple-like
4569// structured bindings
4670namespace std {
@@ -51,6 +75,16 @@ struct tuple_size<B> {
5175 static constexpr unsigned value = 2 ;
5276};
5377
78+ template <>
79+ struct tuple_size <C> {
80+ static constexpr unsigned value = 2 ;
81+ };
82+
83+ template <>
84+ struct tuple_size <D> {
85+ static constexpr unsigned value = 2 ;
86+ };
87+
5488template <unsigned , typename T> struct tuple_element { using type = int ; };
5589
5690// Decomposition of tuple-like bindings but where the `get` methods
@@ -115,5 +149,7 @@ int f() {
115149 v2 //
116150 ;
117151 auto [k, v, w] = std::triple{3 , 4 , 5 };
118- return x1 + y1 + x2 + y2 + z1 + z2 + k + v + w;
152+ auto [m, n] = C{2 , 3 };
153+ auto [s, p] = D{2 , 3 };
154+ return x1 + y1 + x2 + y2 + z1 + z2 + k + v + w + m + n + s + p;
119155}
0 commit comments