https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120336
Bug ID: 120336
Summary: internal compiler error: tree check: expected tree
that contains 'decl minimal' structure, have
'error_mark' in decl_internal_context_p, at
cp/tree.cc:3866 in trunk
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mario.rodriguezb1 at um dot es
Target Milestone: ---
This bug seems related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120314,
not sure if unerlying the are the same, but a different stack dump is shown,
and this one only happens in trunk (at least without reducing).
```
#include <iostream>
namespace mp = std;
template <class... Ts>
struct mp::pair
{
};
```
```
/opt/compiler-explorer/gcc-trunk-20250518/include/c++/16.0.0/bits/stl_pair.h:338:7:
internal compiler error: tree check: expected tree that contains 'decl minimal'
structure, have 'error_mark' in decl_internal_context_p, at cp/tree.cc:3866
338 | swap(const pair& __p) const
| ^~~~
0x2944c55 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x29629c6 internal_error(char const*, ...)
???:0
0x9e1c05 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0xd34ab4 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xd5fecc instantiate_class_template(tree_node*)
???:0
0xdbaef4 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
???:0
0xdbb01c require_complete_type(tree_node*, int)
???:0
0xaf4a5f build_cxx_call(tree_node*, int, tree_node**, int, tree_node*)
???:0
0xb1027e build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xd7dc6c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0xd2773d instantiate_decl(tree_node*, bool, bool)
???:0
0xd61d32 instantiate_pending_templates(int)
???:0
0xbe6361 c_parse_final_cleanups()
???:0
0xe618f8 c_common_parse_file()
???:0
```
To quickly reproduce:
https://godbolt.org/z/dddPM5TKv