llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

Fixes https://github.com/llvm/llvm-project/issues/152901

---
Full diff: https://github.com/llvm/llvm-project/pull/164789.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (-1) 
- (modified) clang/test/AST/ByteCode/records.cpp (+8) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 6b989276e6d7d..c1fbe17bc0d66 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -1842,7 +1842,6 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr 
*> Inits,
                                   const Expr *Init, PrimType T,
                                   bool Activate = false) -> bool {
       InitStackScope<Emitter> ISS(this, isa<CXXDefaultInitExpr>(Init));
-      InitLinkScope<Emitter> ILS(this, InitLink::Field(FieldToInit->Offset));
       if (!this->visit(Init))
         return false;
 
diff --git a/clang/test/AST/ByteCode/records.cpp 
b/clang/test/AST/ByteCode/records.cpp
index 48cf81182c1de..868ca8c74a2f9 100644
--- a/clang/test/AST/ByteCode/records.cpp
+++ b/clang/test/AST/ByteCode/records.cpp
@@ -1840,3 +1840,11 @@ namespace DiamondDowncast {
   constexpr Middle2 &fail = (Middle2&)top1; // both-error {{must be 
initialized by a constant expression}} \
                                             // both-note {{cannot cast object 
of dynamic type 'const Bottom' to type 'Middle2'}}
 }
+
+namespace PrimitiveInitializedByInitList {
+  constexpr struct {
+    int a;
+    int b{this->a};
+  } c{ 17 };
+  static_assert(c.b == 17);
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/164789
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to