https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104278
Bug ID: 104278 Summary: ICE constexpr class non-type template parameter Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pubby.8 at gmail dot com Target Milestone: --- Getting ICE from the following code. The trigger seems to be the 'modify' function. // ----------------------------------- struct foo { int value; constexpr foo modify() const { return { value + 1 }; } }; template<foo f, bool Enable = f.value & 1> struct bar { static void run() { } }; template<foo f> struct qux { static void run() { bar<f.modify()>::run(); } }; // ----------------------------------- Error: test.cpp: In instantiation of ‘static void qux<f, Enable>::run() [with foo f = foo(); bool Enable = false]’: test.cpp:25:16: required from here test.cpp:7:33: internal compiler error: in tsubst_copy, at cp/pt.c:16939 7 | template<foo f, bool Enable = f.value & 1> | ~~^~~~~ 0x1797368 internal_error(char const*, ...) ???:0 0x67f8f9 fancy_abort(char const*, int, char const*) ???:0 0x7fa400 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x7ea4ef instantiate_decl(tree_node*, bool, bool) ???:0 0x80659b instantiate_pending_templates(int) ???:0 0x7136c0 c_parse_final_cleanups() ???:0