Skip to content

Revert "[Sema] Fix crash on invalid code with parenthesized aggregate initialization" #76272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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