------- 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

Reply via email to