| 1 |
// PR c++/28943 void and non-void in conditional expression |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "" } |
| 4 |
|
| 5 |
void debug (const char * string) |
| 6 |
{ |
| 7 |
return; |
| 8 |
} |
| 9 |
|
| 10 |
int f() |
| 11 |
{ |
| 12 |
( true == false ? 0 : debug ("Some string")); // { dg-error "third operand .* type 'void'.* second operand is neither a throw-expression nor of type 'void'" } |
| 13 |
( true == false ? debug ("Some string") : 0 ); // { dg-error "second operand .* type 'void'.* third operand is neither a throw-expression nor of type 'void'" } |
| 14 |
return 0; |
| 15 |
} |