[Bug c++/33902] New: alias warning returning typeid(void)
benoit dot hudson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 26 02:48:00 GMT 2007
I distilled the following from boost, in the following discussion:
http://lists.boost.org/boost-users/2007/10/31690.php
namespace std { class type_info { }; }
struct Cow {
const std::type_info& moo() {
return typeid(void);
}
};
gcc4.3 -O2 -Wall -c reduced.cpp
Complains:
reduced.cpp: In member function 'const std::type_info& Cow::moo()':
reduced.cpp:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules
This is gcc version 4.3.0 20071012 (experimental) (GCC).
The test case was reduced from something that #included the appropriate header
files for the type_info / typeid stuff; substitute that if you don't feel
comfortable with defining my own incompatible type_info.
--
Summary: alias warning returning typeid(void)
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: benoit dot hudson at gmail dot com
GCC target triplet: i386-apple-darwin8.10.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33902
More information about the Gcc-bugs
mailing list