Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Revert "[Sema] Fix crash on invalid code with parenthesized aggregate…
Browse files Browse the repository at this point in the history
… initialization" (#76272)

Reverts llvm/llvm-project#76232 and
7ab16fb to recover build bots.

Breaks libc++ tests, details in #76232

#76228
  • Loading branch information
vitalybuka authored Dec 22, 2023
1 parent 03dc806 commit 2205d23
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
8 changes: 0 additions & 8 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5512,14 +5512,6 @@ static void TryOrBuildParenListInitialization(
} else if (auto *RT = Entity.getType()->getAs<RecordType>()) {
bool IsUnion = RT->isUnionType();
const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
if (RD->isInvalidDecl()) {
// Exit early to avoid confusion when processing members.
// We do the same for braced list initialization in
// `CheckStructUnionTypes`.
Sequence.SetFailed(
clang::InitializationSequence::FK_ParenthesizedListInitFailed);
return;
}

if (!IsUnion) {
for (const CXXBaseSpecifier &Base : RD->bases()) {
Expand Down
28 changes: 0 additions & 28 deletions clang/test/SemaCXX/crash-GH76228.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion clang/test/SemaCXX/paren-list-agg-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ int test() {
// used to crash
S a(0, 1);
S b(0);
S c(0, 0, 1);
S c(0, 0, 1); // beforecxx20-warning {{aggregate initialization of type 'S' from a parenthesized list of values is a C++20 extension}}

S d {0, 1};
S e {0};
Expand Down

0 comments on commit 2205d23

Please sign in to comment.