This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
cannot bind packed field error
- From: Christoph Bartoschek <gcc at pontohonk dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 2 May 2006 16:59:04 +0200
- Subject: cannot bind packed field error
Hi,
compiling the following code with GCC 4.1 I get an error.
struct A {
union {
int c;
} b;
} __attribute__ ((packed));
void func(int const &) {}
void func(int &) {}
int main()
{
A a;
func(a.b.c);
}
Here is the error:
test.C:13: error: cannot bind packed field 'a.A::b.A::<anonymous union>::c'
to'int&'
GCC 3.4.4, GCC 4.0.2 and Intel's compiler compile this code without an error,
but version 4.1 gives me the error.
Is this an error in the compiler or is there a mistake in the code?
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.
Greetings
Christoph Bartoschek