Michiel de Bondt 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).

But even with strings, gcc should give an error like: "strcpy(const char*, const char*) does not exists". In case of a "typedef char string100[100]", gcc behaves correctly by ringing alarm bells. So it seems to be the . operator that behaves incorrectly.

You should distill a minimum and complete testcase that uses = to demonstrate the bug. The example you gave does not assign to an r-value at all, as near as I can tell. As Andrew points out, the array reference will decay to a pointer, which is passed to strcpy. You may want to confirm on comp.lang.c++ or with another C++ compiler that the code is, in fact, invalid.

Thanks for looking into this. :)

Reply via email to