https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115716
Bug ID: 115716
Summary: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16364
Product: gcc
Version: 4.4.7
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rush102333 at gmail dot com
Target Milestone: ---
The following code causes ICE on x86-64 gcc since version 4.4.7:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
template <typename T>
struct x
{
template <typename U>
struct y
{
typedef T result2;
};
};
template<>
template<typename U,typename>
struct x<int>::y
{
typedef double result2;
};
int main()
{
x<int>::y<int>::result2 xxx2;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please check https://godbolt.org/z/xfdsMhcvq for more information.
Compiler Output:
<source>: In instantiation of 'struct x<int>::y<int>':
<source>:21:19: required from here
21 | x<int>::y<int>::result2 xxx2;
| ^~
<source>:15:1: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 1 elts in tsubst, at cp/pt.cc:16364
15 | {
| ^
0x26db045 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
???:0
0x26e8bf2 internal_error(char const*, ...)
???:0
0x97fea5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
???:0
0xcbc3a9 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0xcd4655 instantiate_class_template(tree_node*)
???:0
0xc7421a c_parse_file()
???:0
0xdcaa89 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.