[Bug c++/93617] New: Ternary operator calling a noreturn function should not cause type errors
whoffman at de dot ibm.com
gcc-bugzilla@gcc.gnu.org
Thu Feb 6 17:11:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93617
Bug ID: 93617
Summary: Ternary operator calling a noreturn function should
not cause type errors
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: whoffman at de dot ibm.com
Target Milestone: ---
Created attachment 47792
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47792&action=edit
sample program
Given a ternary operator that calls a function annotated with
__attribute__((noreturn)) in one branch should not lead to type errors. At the
moment, compiling the attached sample program fails with
$ gcc foo.cpp
foo.cpp: In function 'void foo()':
foo.cpp:12:21: error: third operand to the conditional operator is of type
'void', but the second operand is neither a throw-expression nor of type 'void'
12 | int a = b ? 2 : throwError();
| ^
More information about the Gcc-bugs
mailing list