------- Comment #2 from rguenther at suse dot de 2009-11-06 09:16 ------- Subject: Re: Incorrect "dereferencing type-punned pointer will break strict-aliasing rules" warning
On Fri, 6 Nov 2009, pinskia at gcc dot gnu dot org wrote: > ------- Comment #1 from pinskia at gcc dot gnu dot org 2009-11-06 09:09 > ------- > 4.5 also fails and I cannot figure why if I do: "fails"? > #include <new> > struct APInt { > int i; > }; > int main() { > APInt I; > void *d; > char Data[sizeof(APInt)]; > new((void*)Data)APInt(); > d = Data; > *(APInt*)d = I; > } > > GCC does not warn. Of course not - the code is perfectly valid (apart from Data not having suitable alignment for APInt, but that's unrelated to aliasing issues). Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874