This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cannot bind packed field error


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?

> > I expect, that if the compiler really is not able to bind the value to
> > an int&, then it tries to bind the value to int const & as this is done
> > with temporaries for example.


> It won't create a temporary.  But if you want it to, you can do this:
>
>   func(a.b.c + 0);

In the real code c is not an int but another struct. I helped myself by using

func(static_cast<int const>(a.b.c));

Thanks,
Christoph


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]