https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119437
Bug ID: 119437 Summary: ICE in build_base_path, at cp/class.cc:302 Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rush102333 at gmail dot com Target Milestone: --- Goes back to gcc-8: https://godbolt.org/z/Ysez18sqG Test input: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ template<typename T> struct A { typedef int n; int f(); struct B {}; struct C : B { int g() { auto res=[&](){ return f(); }(); return res; } }; }; template<> struct A<int>::B : A<int> {}; A<int>::C::n n = A<int>::C().g(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Stack Dump: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>: In instantiation of 'int A<T>::C::g() [with T = int]': <source>:17:33: required from here 17 | A<int>::C::n n = A<int>::C().g(); | ~~~~~~~~~~~~~^~ <source>:9:17: internal compiler error: in build_base_path, at cp/class.cc:302 9 | return f(); | ~^~ 0x291f785 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x2936756 internal_error(char const*, ...) ???:0 0xacfde6 fancy_abort(char const*, int, char const*) ???:0 0xaf0a63 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) ???:0 0xd72f15 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0xd44f85 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0xd1cb4d instantiate_decl(tree_node*, bool, bool) ???:0 0xd56cfb instantiate_pending_templates(int) ???:0 0xbdd170 c_parse_final_cleanups() ???:0 0xe54628 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~