https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91040
Bug ID: 91040 Summary: Incorrect "invalid use of non-lvalue array" error in conditional assignment with throw Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mark.curtis at bom dot gov.au Target Milestone: --- The following code fails to compile on gcc 9.1.0 with an "invalid use of non-lvalue array" error. void foo(bool condition) { char const* str = condition ? "foo" : throw 1; } This code compiles on the 8 series and earlier, as well as clang. According to the C++ standard section on the conditional operator, in the case that either the second or third operand is a throw expression, "the result is of the type and value category of the other".