Skip to content

Commit 2205d23

Browse files
authored
Revert "[Sema] Fix crash on invalid code with parenthesized aggregate initialization" (#76272)
Reverts #76232 and 7ab16fb to recover build bots. Breaks libc++ tests, details in #76232 #76228
1 parent 03dc806 commit 2205d23

File tree

3 files changed

+1
-37
lines changed

3 files changed

+1
-37
lines changed

clang/lib/Sema/SemaInit.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5512,14 +5512,6 @@ static void TryOrBuildParenListInitialization(
55125512
} else if (auto *RT = Entity.getType()->getAs<RecordType>()) {
55135513
bool IsUnion = RT->isUnionType();
55145514
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
5515-
if (RD->isInvalidDecl()) {
5516-
// Exit early to avoid confusion when processing members.
5517-
// We do the same for braced list initialization in
5518-
// `CheckStructUnionTypes`.
5519-
Sequence.SetFailed(
5520-
clang::InitializationSequence::FK_ParenthesizedListInitFailed);
5521-
return;
5522-
}
55235515

55245516
if (!IsUnion) {
55255517
for (const CXXBaseSpecifier &Base : RD->bases()) {

clang/test/SemaCXX/crash-GH76228.cpp

Lines changed: 0 additions & 28 deletions
This file was deleted.

clang/test/SemaCXX/paren-list-agg-init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ int test() {
289289
// used to crash
290290
S a(0, 1);
291291
S b(0);
292-
S c(0, 0, 1);
292+
S c(0, 0, 1); // beforecxx20-warning {{aggregate initialization of type 'S' from a parenthesized list of values is a C++20 extension}}
293293

294294
S d {0, 1};
295295
S e {0};

0 commit comments

Comments
 (0)