https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100538
Bug ID: 100538 Summary: g++ miscompile / ICE with variadic member function pointer argument list Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: profclonk at gmail dot com Target Milestone: --- Created attachment 50792 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50792&action=edit Source code triggering the GCC bug Dear GCC team, the attached code passes member function pointers to a template function. The code should print "bar" once, but doesn't (miscompile). When commenting out line 19 and enabling line 22 I get an internal compiler error: <source>: In instantiation of 'void foo(MemPtrList<SubRefs ...>) [with SubPtrTypes = int; SubPtrTypes X::* ...SubRefs = {&X::a}]': <source>:26:6: required from here <source>:22:9: internal compiler error: in finish_expr_stmt, at cp/semantics.c:860 22 | (bar<SubPtrTypes> (), ...); | ^ 0x1780bf9 internal_error(char const*, ...) ???:0 0x677e40 fancy_abort(char const*, int, char const*) ???:0 0x80362c finish_expr_stmt(tree_node*) ???:0 0x7dcec3 instantiate_decl(tree_node*, bool, bool) ???:0 0x7f7aab instantiate_pending_templates(int) ???:0 0x708f4d c_parse_final_cleanups() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ASM generation compiler returned: 1 The error happens on x86-64 Windows 10 when using MinGW-w64 via MSYS2, and also on Compiler Explorer ( https://godbolt.org/z/vhPqKaqeW , https://godbolt.org/z/feP5GPdP4 ). It works fine in Clang. Thanks, Niklas