https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105060
Bug ID: 105060 Summary: [10/11] ICE with consteval function: internal compiler error: in cp_gimplify_expr, at cp/cp-gimplify.c:14879 with keep-inline-functions Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lutztonineubert at gmail dot com Target Milestone: --- Compiled with g++ 10/11 and -fkeep-inline-functions -std=c++20. Doesn't seem to happen with current trunk. ERROR: <source>: In constructor 'consteval basic_format_string<Args>::basic_format_string(const S&) [with S = char [1]; Args = {char, <unnamed enum>}]': <source>:19:5: internal compiler error: in gimplify_expr, at gimplify.c:14879 19 | if (!check()) { | ^~ 0x1786229 internal_error(char const*, ...) ???:0 0x678608 fancy_abort(char const*, int, char const*) ???:0 0xab0f92 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0xab1068 gimplify_stmt(tree_node**, gimple**) ???:0 0xaaebb2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0xab1068 gimplify_stmt(tree_node**, gimple**) ???:0 0xab212b gimplify_body(tree_node*, bool) ???:0 0xab259f gimplify_function_tree(tree_node*) ???:0 0x943cf7 cgraph_node::analyze() ???:0 0x94707d symbol_table::finalize_compilation_unit() ???:0 CODE: template <typename T> struct type_identity { using type = T; }; template <typename T> using type_identity_t = typename type_identity<T>::type; constexpr int check() { return {}; } template <typename... Args> class basic_format_string { public: template <typename S> consteval basic_format_string(const S& s) { if (!check()) { } } }; template <typename... Args> using format_string = basic_format_string<char, type_identity_t<Args>...>; template <typename... Args> void test(format_string<Args...> format_str, const Args&... args) {} enum { Blue }; void g() { test("", Blue); } See: https://gcc.godbolt.org/z/M7v96YPn1