tbaederr wrote:

If you add this:

```diff
diff --git i/clang/lib/AST/ByteCode/Compiler.cpp 
w/clang/lib/AST/ByteCode/Compiler.cpp
index 1e58d91861ad..18a425c4f490 100644
--- i/clang/lib/AST/ByteCode/Compiler.cpp
+++ w/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4002,6 +4002,8 @@ bool Compiler<Emitter>::VisitCXXNewExpr(const CXXNewExpr 
*E) {
     if (PlacementDest) {
       if (!this->visit(PlacementDest))
         return false;
+      if (!this->emitExpandPtr(E))
+        return false;
       if (!this->emitGetLocal(SizeT, ArrayLen, E))
         return false;
       if (!this->emitCheckNewTypeMismatchArray(SizeT, E, E))
```

and this
```diff
diff --git i/clang/lib/AST/ByteCode/Pointer.h w/clang/lib/AST/ByteCode/Pointer.h
index 3eb9cfc4e53d..fe7ad38e2c99 100644
--- i/clang/lib/AST/ByteCode/Pointer.h
+++ w/clang/lib/AST/ByteCode/Pointer.h
@@ -764,7 +764,7 @@ public:
     if (BS.Base < sizeof(InlineDescriptor))
       return Lifetime::Started;

-    if (inArray() && !isArrayRoot()) {
+    if (getFieldDesc()->isPrimitiveArray() && !isArrayRoot()) {
       InitMapPtr &IM = getInitMap();

       if (!IM.hasInitMap()) {
```

and then in `CheckNewTypeMismatch`, you keep the `Ptr` `const`  and do
```c++
    if (ASTCtx.hasSimilarType(AllocElementType, StorageType))
      StorageType = Ptr.getArray().getType();
```
the FIXME cases should work as well.

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

Reply via email to