[clang] [clang][AST] Invalidate DecompositionDecl if it has invalid initializer. (PR #72428)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 09:44:48 PST 2023
================
@@ -24,4 +24,17 @@ void test() {
auto b4 = A(1);
// CHECK: `-VarDecl {{.*}} invalid b5 'auto'
auto b5 = A{1};
-}
\ No newline at end of file
+}
+
+void pr72198() {
+ // CHECK: DecompositionDecl {{.*}} invalid 'int'
+ int [_, b] = {0, 0};
+ [b]{};
+}
+
+int get_point();
+void pr67495() {
+ // CHECK: DecompositionDecl {{.*}} invalid 'int &'
+ auto& [x, y] = get_point();
+ [x, y] {};
+}
----------------
cor3ntin wrote:
```suggestion
namespace GH67495 {
int get_point();
void f() {
// CHECK: DecompositionDecl {{.*}} invalid 'int &'
auto& [x, y] = get_point();
[x, y] {};
}
}
```
https://github.com/llvm/llvm-project/pull/72428
More information about the cfe-commits
mailing list