================
@@ -2753,10 +2753,18 @@ static bool resolveAllocationOverloadInterior(
     if (Diagnose) {
       // If this is an allocation of the form 'new (p) X' for some object
       // pointer p (or an expression that will decay to such a pointer),
-      // diagnose the missing inclusion of <new>.
+      // diagnose potential error.
       if (!R.isClassLookup() && Args.size() == 2 &&
           (Args[1]->getType()->isObjectPointerType() ||
            Args[1]->getType()->isArrayType())) {
+        if (Args[1]->getType()->isPointerType()) {
----------------
vbvictor wrote:

> should probably be earlier - this is inside an array of object check

We have `isObjectPointerType() || isArrayType()` in first `if`, so pointer are 
handled correctly, I added tests for that.

I used `Context.getBaseElementType()`, but still had to manually check for 
pointer because it only unwraps arrays. 

https://github.com/llvm/llvm-project/pull/144270
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to