The following code, compiled with -O2 -Wall (g++ 4.3 as of 20070607), produces the following unexpected/annoying warning:
test_typeinfo.cpp: In function 'int main()': test_typeinfo.cpp:5: warning: dereferencing type-punned pointer will break strict-aliasing rules test_typeinfo.cpp:5: warning: unused variable 't' ~> cat test_typeinfo.cpp #include <typeinfo> int main() { const std::type_info & t = typeid(int); } Is this really meant to warn for such a code??? -- Summary: too many warning: dereferencing type-punned pointer will break strict-aliasing rules Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sylvain dot pion at sophia dot inria dot fr GCC host triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32260