[Bug c++/37146] [4.4 Regression] Invalid types with COND_EXPR
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 10 15:11:00 GMT 2008
------- Comment #5 from jakub at gcc dot gnu dot org 2008-09-10 15:10 -------
I think primarily we want to agree on what is and is not valid lvalue when
bitfields are involved.
int a;
int b;
struct A { int i:8; int j:8; int k:16; int l:32; } c;
void
foo (int x, int y)
{
(x ? a : b) = y;
(x ? c.i : c.j) = y; // error with #c3 patch
(x ? c.i : a) = y; // error with #c3 and #c5 patch
(x ? c.i : c.k) = y; // error with #c3 and #c5 patch
#if __INT_MAX__ == 2147483647
(x ? c.l : b) = y;
#endif
}
If all are supposed to be valid, then I fixing this is going to be hard. We'll
need to create COND_EXPR with mismatching types and then fix it up immediately
once we figure out the COND_EXPR isn't used as lvalue.
The #c3 patch is above, I'll attach another patch as well which allows
bitfields
if they have the same declared type and precision.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37146
More information about the Gcc-bugs
mailing list