[Bug c++/38007] [4.2/4.3/4.4 Regression] g++ instantiate same operator twice due to bitfield in -O0 mode, causing symbol already defined assembler error
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 4 10:41:00 GMT 2008
------- Comment #2 from rguenth at gcc dot gnu dot org 2008-11-04 10:39 -------
The following also fails the same way with optimization:
class foo {
public:
template <typename T> __attribute__((noinline))
operator T () { return (T)0; }
};
struct bar {
unsigned int _bar : 24;
};
int main()
{
foo a;
unsigned int b = a;
bar c;
c._bar = a;
return 0;
}
we instantiate the operator for unsigned int and unsigned int : 24
what we probably should do is treat
c._bar = a;
as
c._bar = (unsigned int : 24)(unsigned int)a;
instead.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38007
More information about the Gcc-bugs
mailing list