gcc 6.1.0 bogus placement new warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It seems if you have an array of pointers, and attempt:

  object* TheArray[2];
  TheArray[x] = (object*) malloc(NUM * sizeof(object));
  new (TheArray[x] + num) object(...);

The check uses size of TheArray (16 bytes), and not the large allocation which TheArray[x] points to.  Known bug?  Easy to work around with a temp variable at least.

error: placement new constructing an object of type '...' and size '120' in a region of type 'object* [2] {...* [2]}' and size at most '16' [-Werror=placement-new=]




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux