From b27872d5c5bfecae74195771f5c1f4e73385b6d6 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 8 Sep 2026 21:14:03 +0200 Subject: Fix ICE with offset trait and non-type identifier --- boot/type_check.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'boot') diff --git a/boot/type_check.cc b/boot/type_check.cc index ab22a1c..5078da1 100644 --- a/boot/type_check.cc +++ b/boot/type_check.cc @@ -17,6 +17,7 @@ along with GCC; see the file COPYING3. If not see #include "elna/boot/type_check.h" #include "elna/boot/evaluator.h" +#include "elna/boot/name_analysis.h" #include #include @@ -1738,7 +1739,20 @@ namespace elna::boot add_error(trait->name.position(), trait->name.name(), trait_error::unsupported_type{ trait->types.front() }); } - else if (trait->arguments.at(1)->is_named() == nullptr) + else if (auto *field = trait->arguments.at(1)->is_named()) + { + if (erase_generic(trait->types.front()).get() == nullptr) + { + add_error(trait->name.position(), trait->name.name(), + trait_error::unsupported_type{ trait->types.front() }); + } + else if (lookup_field(trait->types.front(), field->name).empty()) + { + add_error(field->position(), field->name, + trait->types.front(), member_error::kind::not_found); + } + } + else { add_error(trait->arguments.at(1)->position(), trait->name.name(), trait_error::offset_not_field_name{}); -- cgit v1.2.3