[clang] [Clang][Sema] placement new initializes typedef array with correct size (PR #83124)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 06:28:00 PST 2024


================
@@ -12669,6 +12669,19 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
     ArraySize = NewArraySize.get();
   }
 
+  // Per C++0x [expr.new]p5, the type being constructed may be a
+  // typedef of an array type.
----------------
erichkeane wrote:

This comment doesn't really match what is happening below?  the 'if' is still based on 'ArraySize' (presumably you mean this to be a proxy for `E->isArray`?).  But there is no standardeeze quoted here about why you'd pick up the size/alloc type from it like this, rather than in the `E->isArray` above.   

Also, does this also handle cases where this is going to still be dependent?  

https://github.com/llvm/llvm-project/pull/83124


More information about the cfe-commits mailing list