Following code produces symbol already defined assembler error when compiled with g++ 4.2.4 with -O0 flag. It can compile without problem with g++ 4.1.1.
=== foo.hpp === class foo { public: template <typename T> operator T (); }; template <typename T> inline foo::operator T () { return (T)0; } === foo.cpp === #include "foo.hpp" struct bar { unsigned int _bar : 24; }; int main() { foo a; unsigned int b = a; bar c; c._bar = a; return 1; } ==== compile with g++ -O0 foo.cpp Regards, Jeng-Liang -- Summary: g++ instantiate same operator twice due to bitfield in - O0 mode, causing symbol already defined assembler error Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jengliang at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38007