-Wplacement-new on by default
Martin Sebor
msebor@gmail.com
Thu Dec 10 18:01:00 GMT 2015
Jason,
I just want to make sure we still want the -Wplacement-new option
I added some time ago enabled by default.
I think I had initially intended it to be on because the original
implementation was more permissive and didn't diagnose cases where
(for example) the buffer spanned multiple members of the same struct,
as in the example below. After our discussion of the patch where
you pointed out that C++ is moving in the direction of increased
strictness of aliasing requirements, I changed it to diagnose
those cases.
Can you please confirm that enabling -Wplacement-new by default
is still appropriate?
Thanks
Martin
struct S {
int a;
char b;
} s;
new (&s) char [sizeof s]; // accepted
new (&s.a) char [sizeof s]; // diagnosed
More information about the Gcc
mailing list