https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117826
Bug ID: 117826 Summary: ICE: tree check: expected tree that contains 'decl minimal' structure, have 'tree_list' in hash, at tree.h:5958 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Created attachment 59735 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59735&action=edit cpp testcase ******************************************************************************* The compiler produces an internal error during tree_contains_struct_check_failed when compiling the provided code with the specified options. The issue can also be reproduced on Compiler Explorer. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241127/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241127 --enable-languages=c,c++ --disable-multilib --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20241127 (experimental) (GCC) ******************************************************************************* Program:Please refer to the attachment. ******************************************************************************* Command Lines: # g++ -g bug.cpp ....... ^ <source>:15326:27: error: there are no arguments to '_Indices' that depend on a template parameter, so a declaration of '_Indices' must be available [-Wtemplate-body] 15326 | return _M_invoke(_Indices()); | ^~~~~~~~ <source>: In member function 'typename std::result_of<_Functor(_ArgTypes ...)>::type std::_Bind_simple<_Callable(_Args ...)>::_M_invoke(int)': <source>:15333:24: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15333 | return std::forward<_Callable>(std::get<0>(_M_bound))( | ^~~~~~~ <source>:15333:24: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15333:41: error: expected primary-expression before '>' token [-Wtemplate-body] 15333 | return std::forward<_Callable>(std::get<0>(_M_bound))( | ^ <source>:15333:48: error: 'get' is not a member of 'std' [-Wtemplate-body] 15333 | return std::forward<_Callable>(std::get<0>(_M_bound))( | ^~~ <source>:15333:55: error: '_M_bound' was not declared in this scope [-Wtemplate-body] 15333 | return std::forward<_Callable>(std::get<0>(_M_bound))( | ^~~~~~~~ <source>:15334:21: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15334 | std::forward<_Args>(std::get<_Indices+1>(_M_bound))...); | ^~~~~~~ <source>:15334:21: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15334:34: error: expected primary-expression before '>' token [-Wtemplate-body] 15334 | std::forward<_Args>(std::get<_Indices+1>(_M_bound))...); | ^ <source>:15334:41: error: 'get' is not a member of 'std' [-Wtemplate-body] 15334 | std::forward<_Args>(std::get<_Indices+1>(_M_bound))...); | ^~~ <source>: In function 'typename std::_Bind_simple_helper<_Func, _BoundArgs>::__type std::__bind_simple(_Callable&&, _Args&& ...)': <source>:15355:42: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15355 | __maybe_type::__do_wrap( std::forward<_Callable>(__callable)), | ^~~~~~~ <source>:15355:42: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15356:17: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15356 | std::forward<_Args>(__args)...); | ^~~~~~~ <source>:15356:17: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15354:28: error: expected primary-expression before '(' token [-Wtemplate-body] 15354 | return __result_type( | ^ <source>:15355:42: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15355 | __maybe_type::__do_wrap( std::forward<_Callable>(__callable)), | ^~~~~~~ <source>:15355:42: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15355:59: error: expected primary-expression before '>' token [-Wtemplate-body] 15355 | __maybe_type::__do_wrap( std::forward<_Callable>(__callable)), | ^ <source>:15356:17: error: 'forward' is not a member of 'std' [-Wtemplate-body] 15356 | std::forward<_Args>(__args)...); | ^~~~~~~ <source>:15356:17: note: 'std::forward' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>:15356:30: error: expected primary-expression before '>' token [-Wtemplate-body] 15356 | std::forward<_Args>(__args)...); | ^ <source>: At global scope: <source>:15359:4: error: expected class-name before '{' token 15359 | { | ^ <source>: In static member function 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&)': <source>:15490:37: error: 'move' is not a member of 'std' [-Wtemplate-body] 15490 | { _M_init_functor(__functor, std::move(__f), _Local_storage()); } | ^~~~ <source>:15490:37: note: 'std::move' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' <source>: In static member function 'static void std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&, _Functor&&, std::true_type)': <source>:15510:47: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'tree_list' in hash, at tree.h:5958 15510 | { new (__functor._M_access()) _Functor(std::move(__f)); } | ^~~~ 0x28d1025 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x28e7d15 internal_error(char const*, ...) ???:0 0x9a3c6d tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ???:0 0xbaf44d hash_table<hash_map<tree_node*, unsigned int, simple_hashmap_traits<tree_decl_hash, unsigned int> >::hash_entry, false, xcallocator>::expand() ???:0 0x28d0a85 diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x28d1025 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x28e75ff error_at(unsigned int, char const*, ...) ???:0 0xbadc00 qualified_name_lookup_error(tree_node*, tree_node*, tree_node*, unsigned int) ???:0 0xd3637b finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) ???:0 0xca82da c_parse_file() ???:0 0xe04149 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. Compiler returned: 1 ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/EjczEEf9h *******************************************************************************