]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: Wmismatched-new-delete-5.C tweak
authorJason Merrill <jason@redhat.com>
Tue, 22 Jul 2025 20:27:28 +0000 (16:27 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 22 Jul 2025 21:32:54 +0000 (17:32 -0400)
A patch I was testing noticed that the allocation is too small for the
placement new here, but that isn't the point of the testcase.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wmismatched-new-delete-5.C: Fix allocation.

gcc/testsuite/g++.dg/warn/Wmismatched-new-delete-5.C

index bac2b68aa641f25a0da1ebf420d8d3436bd152bd..a21e864e6a6b5fd71c6fe322b3115c0407a29071 100644 (file)
@@ -31,7 +31,7 @@ void warn_placement_new ()
 
 void warn_placement_array_new ()
 {
-  void *p = malloc (sizeof (int));
+  void *p = malloc (sizeof (int) * 2);
   int *q = new (p) int[2];
   delete q;                   // { dg-warning "-Wmismatched-new-delete" }
 }