This is the mail archive of the gcc-bugs@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]

regression in support of ({ ... }) in g++


i386-linux (fwiw)

casey:~/casey/gnu/cvs/egcs/b/gcc$ cat foo.cc
union s
{
    int flat;
    struct {
        int a : 16;
        int b : 16;
    } bits;
} ss;

void
foo ()
{
    ss = ({ union s x; x.flat = 0; x; });
}
casey:~/casey/gnu/cvs/egcs/b/gcc$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
casey:~/casey/gnu/cvs/egcs/b/gcc$ g++ -O2 -fomit-frame-pointer -S foo.cc

yields:

foo__Fv:
.LFB1:
	movl $0,ss
	ret

can't ask for better than that.

However, current cvs gcc can't even compile foo.cc.

casey:~/casey/gnu/cvs/egcs/b/gcc$ ./xgcc -B./ -v
Reading specs from ./specs
Configured with: 
gcc version 2.97 20001005 (experimental)
casey:~/casey/gnu/cvs/egcs/b/gcc$ ./xgcc -B./ -O2 -fomit-frame-pointer -S foo.cc
foo.cc: In function `void foo()':
foo.cc:13: non-lvalue in unary `&'

I went back and read the docs on statement expressions
and they now have lots of caveats regarding using
statement expressions with c++.

Still, I'm curious why this particular regression occured.  :-(

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