This is the mail archive of the gcc@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: Bug in gcc: assignment to non-lvalue


On 21/09/2007, Michiel de Bondt <debondt@math.ru.nl> wrote:
> Using strings to show my point was not a good idea. You can add a field
> "int number" to the struct and perform similar operations (with =
> instead of strcpy).

I believe Andrew's right and the strcpy case is valid, but you do have
a point. I think this should be rejected:

struct A { int i; };
struct B { A get() { return A(); } };

int main ()
{
    B b;
    b.get().i = 0;
    // int& error = b.get().i;
}


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