--- Comment #6 from redi at gcc dot gnu dot org 2010-04-29 14:17 ---
for further confirmation, the original case is covered by:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#367
and my cases are covered by:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#236
--- Comment #5 from redi at gcc dot gnu dot org 2010-04-29 14:11 ---
the definition of integral constant expression has changed between C++03 and
C++0x, so that int() is a valid integral constant expression, as is int(b?0:0)
So that makes my 'f' and 'g' examples valid.
However, by [exp
--- Comment #4 from redi at gcc dot gnu dot org 2010-04-29 13:34 ---
That example 'f' is equivalent to this, which also compiles:
int* g(bool b) { return int(b ? 0 : 0); }
that's /definitely/ wrong
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43932
--- Comment #3 from redi at gcc dot gnu dot org 2010-04-29 13:31 ---
See [expr.cond]p2
if one operand is a throw-expression the result of the conditional-expression
is an rvalue of the type of the other operand (i.e. int)
I think it's actually a bug that this compiles:
int* f(bool b) {
--- Comment #2 from joerg dot richter at pdv-fs dot de 2010-04-29 12:54
---
But throw can be part of ?: operator:
$ cat t.cc
int func( bool b )
{
return b ? 0 : throw 5;
}
$ g++ -c t.cc
--
joerg dot richter at pdv-fs dot de changed:
What|Removed
--- Comment #1 from schwab at linux-m68k dot org 2010-04-29 12:09 ---
A throw-expression cannot be part of a integral constant expression, thus it
cannot be a null pointer constant.
--
schwab at linux-m68k dot org changed:
What|Removed |Added
-