https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117158
Bug ID: 117158
Summary: ICE with array access inside a template with a base
class
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: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
struct Base
{
unsigned int *intarray;
};
template <typename T> struct Sub : public Base
{
bool Get(int i)
{
return (Base::intarray[++i] == 0);
}
};
```
This ICEs with:
```
<source>: In member function 'bool Sub<T>::Get(int)':
<source>:10:35: internal compiler error: tree check: did not expect class
'type', have 'type' (record_type) in contains_placeholder_p, at tree.cc:4119
10 | return (Base::intarray[++i] == 0);
| ^
0x286a525 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x287e305 internal_error(char const*, ...)
???:0
0x999d9c tree_not_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
???:0
0x17429fb save_expr(tree_node*)
???:0
0xd67848 cp_build_array_ref(unsigned int, tree_node*, tree_node*, int)
???:0
0xb84e52 grok_array_decl(unsigned int, tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, int)
???:0
0xc98ffa c_parse_file()
???:0
0xdf0c19 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.
```