Skip to content

Commit cf947cb

Browse files
committed
Address comments.
1 parent 1c273c4 commit cf947cb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13606,9 +13606,9 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
1360613606
// part in the valid bit of the declaration. There are a few exceptions:
1360713607
// 1) if the var decl has a deduced auto type, and the type cannot be
1360813608
// deduced by an invalid initializer;
13609-
// 2) if the var decl is decompsition decl with a concrete type (e.g.
13610-
// `int [a, b] = 1;`), and the initializer is invalid;
13611-
// Case 1) is already handled earlier in this function.
13609+
// 2) if the var decl is decompsition decl with a non-deduced type, and
13610+
// the initialization fails (e.g. `int [a] = {1, 2};`);
13611+
// Case 1) was already handled elsewhere.
1361213612
if (llvm::isa<DecompositionDecl>(VDecl)) // Case 2)
1361313613
VDecl->setInvalidDecl();
1361413614
return;

clang/test/AST/ast-dump-invalid-initialized.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ void test() {
2626
auto b5 = A{1};
2727
}
2828

29-
void pr72198() {
29+
void GH72198() {
3030
// CHECK: DecompositionDecl {{.*}} invalid 'int'
3131
int [_, b] = {0, 0};
3232
[b]{};
3333
}
3434

35+
namespace GH67495 {
3536
int get_point();
36-
void pr67495() {
37+
void f() {
3738
// CHECK: DecompositionDecl {{.*}} invalid 'int &'
3839
auto& [x, y] = get_point();
3940
[x, y] {};
4041
}
42+
}

0 commit comments

Comments
 (0)