[llvm-branch-commits] [clang] 4c72931 - Revert "[Sema] Fix crash on invalid code with parenthesized aggregate initialization (#76232)"

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Dec 22 14:23:50 PST 2023


Author: Vitaly Buka
Date: 2023-12-22T14:23:46-08:00
New Revision: 4c7293181d3139e16647c3c6daeeb3ae7b344816

URL: https://github.com/llvm/llvm-project/commit/4c7293181d3139e16647c3c6daeeb3ae7b344816
DIFF: https://github.com/llvm/llvm-project/commit/4c7293181d3139e16647c3c6daeeb3ae7b344816.diff

LOG: Revert "[Sema] Fix crash on invalid code with parenthesized aggregate initialization (#76232)"

This reverts commit 86dc6e15f22610bbb53eb4efda0a178ecefc933a.

Added: 
    

Modified: 
    clang/lib/Sema/SemaInit.cpp

Removed: 
    clang/test/SemaCXX/crash-GH76228.cpp


################################################################################
diff  --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index cc9db5ded1149a..61d244f3bb9798 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -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()) {

diff  --git a/clang/test/SemaCXX/crash-GH76228.cpp b/clang/test/SemaCXX/crash-GH76228.cpp
deleted file mode 100644
index 33a9395823127e..00000000000000
--- a/clang/test/SemaCXX/crash-GH76228.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: %clang_cc1 -std=c++20 -verify %s
-// Check we don't crash on incomplete members and bases when handling parenthesized initialization.
-class incomplete; // expected-note at -0 3  {{forward declaration of 'incomplete'}}
-struct foo {
-  int a;
-  incomplete b;
-  // expected-error at -1 {{incomplete type}}
-};
-foo a1(0);
-
-struct one_int {
-    int a;
-};
-struct bar : one_int, incomplete {};
-// expected-error at -1 {{incomplete type}}
-bar a2(0);
-
-incomplete a3[3](1,2,3);
-// expected-error at -1 {{incomplete type}}
-
-struct qux : foo {
-};
-qux a4(0);
-
-struct fred {
-    foo a[3];
-};
-fred a5(0);


        


More information about the llvm-branch-commits mailing list