llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

It's neither a record nor an array.

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


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/EvaluationResult.cpp (+1-2) 
- (modified) clang/test/AST/ByteCode/invalid.cpp (+15) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.cpp 
b/clang/lib/AST/ByteCode/EvaluationResult.cpp
index 5d232c5414e04..09b1eb822b13e 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.cpp
+++ b/clang/lib/AST/ByteCode/EvaluationResult.cpp
@@ -55,8 +55,7 @@ static bool CheckArrayInitialized(InterpState &S, 
SourceLocation Loc,
       PtrView ElemPtr = BasePtr.atIndex(I).narrow();
       Result &= CheckFieldsInitialized(S, Loc, ElemPtr, R);
     }
-  } else {
-    assert(ElemDesc->isArray());
+  } else if (ElemDesc->isArray()) {
     for (size_t I = 0; I != NumElems; ++I) {
       PtrView ElemPtr = BasePtr.atIndex(I).narrow();
       Result &= CheckArrayInitialized(S, Loc, ElemPtr);
diff --git a/clang/test/AST/ByteCode/invalid.cpp 
b/clang/test/AST/ByteCode/invalid.cpp
index 2e822e0b56d91..3dd2dc91df9c1 100644
--- a/clang/test/AST/ByteCode/invalid.cpp
+++ b/clang/test/AST/ByteCode/invalid.cpp
@@ -267,3 +267,18 @@ namespace SubPtrResultIs1 {
   struct C : A, B {};
   unsigned char x = ((char **)(B *)(C *)0x1000) - (char *)0x1000; // 
both-error {{not pointers to compatible types}}
 }
+
+namespace NonRecordNonArrayDesc {
+
+  struct S { // both-note {{definition of 'NonRecordNonArrayDesc::S' is not 
complete until the closing '}'}}
+    const S(foo[42]) : bar{}; // both-error {{use of undeclared identifier 
'bar'}} \
+                              // both-error {{field has incomplete type 'const 
S'}}
+  };
+
+  struct F {
+    _Atomic(S) a;
+    constexpr F(int i) {};
+  };
+
+  F foo(42);
+}

``````````

</details>


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

Reply via email to