[cfe-commits] r81251 - in /cfe/trunk: include/clang/AST/APValue.h lib/AST/APValue.cpp
Mike Stump
mrs at apple.com
Tue Sep 8 13:16:11 PDT 2009
On Sep 8, 2009, at 12:57 PM, Douglas Gregor wrote:
> Make sure to access APValue's data via a char array (rather than
> through an array of void*), so that we don't run afoul of the
> strict-aliasing rules in C++ 3.10p15.
> Unfortunately, GCC 4.4 still complains about this code.
> - return *(APSInt*)(void*)Data;
> + return *(APSInt*)(char*)Data;
This doesn't match your description. If you think this access is
through a char to ensure this conforms to the standard... I'd be
happy to give you the aliasing rules class... This is an access
through a type of APSInt, which is unrelated to char.
gcc still would give an error, as this code is still runs afoul of the
rules (I bet).
p = new APSInt newobj;
memcpy (p, Data, sizeof(newobj);
is an access through type char.
?
More information about the cfe-commits
mailing list