[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread redi at gcc dot gnu dot org
--- 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) {

[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread joerg dot richter at pdv-fs dot de
--- 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

[Bug c++/43932] conditional operator can't convert 0 to pointer

2010-04-29 Thread schwab at linux-m68k dot org
--- 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 -