[2.95.1] 0 ? 0 : throw "foo"
Florian Weimer
fw@deneb.cygnus.argh.org
Tue Sep 7 04:50:00 GMT 1999
GCC version: 2.95.1 on a glibc-2.0.7-based GNU/Linux system
The following code snippet doesn't compile:
int main() {
int x = 0 ? 0 : throw "foo";
return 0;
}
t.cc: In function `int main()':
t.cc:2: converting to `void' from `int'
t.cc:2: void value not ignored as it ought to be
According to ISO 14882, section 5.16(2), the code is correct:
| - The second or the third operand (but not both) is a
| throw-expression (15.1); the result is of the type of the
| other and is an rvalue.
More information about the Gcc-bugs
mailing list