------- Comment #2 from ian at airs dot com  2007-10-25 05:07 -------
Nothing is taking the address of a bitfield.  It's a const reference, which
should get initialized with the value.  If the reference is not const, then the
compiler gives an error.

In any case, this code fails the same way, and clearly does not take the
address of a bitfield.

extern "C" void abort() __attribute__ ((noreturn));

template<typename t1, typename t2>
void fn(const t1, const t2) __attribute__ ((noinline));

template<typename t1, typename t2>
void fn(const t1 v1, const t2 v2)
{
  if (v1 != v2)
    abort();
}

struct s
{
  unsigned long long f1 : 40;
  unsigned int f2 : 24;
};

s sv;

int main()
{
  sv.f1 = 0;
  sv.f2 = (1 << 24) - 1;
  int f2 = sv.f2;
  fn(f2, (1 << 24) - 1);
  ++sv.f2;
  f2 = sv.f2;
  fn(f2, 0);
  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33887

Reply via email to