http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54543
Bug #: 54543 Summary: Expression (condition ? array : throw expr)[index] fails to compile Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ts...@mail.ru g++ 4.8.0 20120909 (experimental) fails to compile the following well-defined code: int f(int (&arr)[10], int n) { return ((0 <= n && n < 10) ? arr : throw "error")[n]; } int main() {} COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro' test.cpp: In function ‘int f(int (&)[10], int)’: test.cpp:3:46: error: void value not ignored as it ought to be return ((0 <= n && n < 10) ? arr : throw "error")[n]; ^ Compiler version info: Target: i686-pc-linux-gnu Configured with: ../configure --prefix=../target --enable-languages=c,c++ Thread model: posix GNU C++ (GCC) version 4.8.0 20120909 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 4.8.0 20120909 (experimental), GMP version 5.0.2, MPFR version 3.1.0, MPC version 0.8.2