https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86878
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Created attachment 44517 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44517&action=edit Prototype patch. Confirmed. Adding the warning to the middle-end is pretty simple. With the operator declared with the attribute I get the following with my simple patch (the real solution will use its own option to control the warning): pr86878.C: In function ‘int main()’: pr86878.C:11:15: warning: argument 2 value 5 is not a positive power of two [-Wattributes] (void) alloc(10, 5); ~~~~~^~~~~~~ pr86878.C:4:7: note: in a call to allocation function ‘void* alloc(std::size_t, std::size_t)’ declared here void* alloc(std::size_t, std::size_t); ^~~~~ pr86878.C:12:24: warning: argument 2 value (std::align_val_t)5 is not a positive power of two [-Wattributes] (void) ::operator new(10, std::align_val_t{5}); ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ pr86878.C:6:7: note: in a call to allocation function ‘void* operator new(long unsigned int, std::align_val_t)’ declared here void* operator new(__SIZE_TYPE__, std::align_val_t) ^~~~~~~~