Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: donald.chai at synopsys dot com
Target Milestone: ---
Preface:
1) Apologies if this is the wrong component.
2) Yes, this code is crazy. I was testing our own compiler. :)
GCC 5.x
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: donald.chai at synopsys dot com
Target Milestone: ---
GCC, in C++ mode, appears to evaluate pre-increments twice in GNU ternaries:
$ gcc-5 --version
gcc-5 (Ubuntu 5.2.1-23ubuntu1~12.04) 5.2.1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70744
--- Comment #5 from Donald Chai ---
For what it's worth, post-increments behave as I would expect:
$ cat test.c
int main() {
int x = 1;
x++ ?: 0xbeef;
return x;
}
$ gcc-5 -x c test.c; ./a.out; echo $?
2
$ gcc-5 -x c++ test.c; ./a.out