https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91740
Bug ID: 91740 Summary: ICE in fold_convert_loc, at fold-const.c:2429 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: julien at vivenot dot fr Target Milestone: --- The following causes an internal compiler error on gcc 9.2.0 on x86-64. I do not have access to other versions myself but tested on godbolt: It seems to say that 9.1, 9.2 and current trunk are affected, while 8.3 is unaffected. $ cat test.cpp constexpr bool f(const char*) { return true; } template<typename T> const char c = "FOO"[f("BAR") ? 1 : 0]; $ g++ test.cpp test.cpp:2:59: internal compiler error: in fold_convert_loc, at fold-const.c:2429 2 | template<typename T> const char c = "FOO"[f("BAR") ? 1 : 0]; | ^ The current code is obviously meaningless because it has been slowly scaled down from production code. I have noted that any of the following changes make the issue disappear : - removing the argument to f() - removing the templatization - removing the ternary operator