pr28943.c

来自「用于进行gcc测试」· C语言 代码 · 共 16 行

C
16
字号
// PR c++/28943 void and non-void in conditional expression// { dg-do compile }// { dg-options "" }void debug (const char * string){  return;}int f(){  ( true == false ? 0 : debug ("Some string")); // { dg-error "third operand .* type 'void'.* second operand is neither a throw-expression nor of type 'void'" }  ( true == false ? debug ("Some string") : 0 ); // { dg-error "second operand .* type 'void'.* third operand is neither a throw-expression nor of type 'void'" }  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?