This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: cannot bind packed field error
Christoph Bartoschek writes:
> Am Dienstag, 2. Mai 2006 17:28 schrieb John Love-Jensen:
>
> > > Is this an error in the compiler or is there a mistake in the code?
> >
> > I think (but I'm not sure) that it is a mistake in the code.
> >
> > In that the alignment and packing constraints of a.b.c are different from
> > a plain old int& and int const&.
>
> But why does the call to func(int const &) succeed, if I remove the other
> func function?
Because the compiler doesn't know what you're trying to do. Let's say
that you intended to modify the packed field. Clearly the compiler
can't do that, as a packed int isn't compatible with an int. So what
would you rather have? A compile-time error, or the compiler silently
call func(int const &) instead?
Andrew.