diff options
Diffstat (limited to 'boot/materialization.cc')
| -rw-r--r-- | boot/materialization.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/boot/materialization.cc b/boot/materialization.cc index e055dfd..8c436b3 100644 --- a/boot/materialization.cc +++ b/boot/materialization.cc @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { materialization_error::materialization_error(const source_position position) - : error(position) + : diagnostic(position) { } @@ -43,6 +43,11 @@ namespace elna::boot if (auto negated_literal = literal->value.negate()) { literal->value = negated_literal.value(); + if (!literal->has_explicit_size + && !literal->value.fit_into(true, target.int_properties.front().size)) + { + add_error<materialization_error>(literal->position()); + } } else { @@ -50,12 +55,23 @@ namespace elna::boot } break; case unmarked: - if (!literal->value.fit_into(true, literal->value.size())) + { + const auto target_size = literal->has_explicit_size + ? literal->value.size() + : target.int_properties.front().size; + + if (!literal->value.fit_into(true, target_size)) { add_error<materialization_error>(literal->position()); } break; + } case _unsigned: + if (!literal->has_explicit_size + && !literal->value.fit_into(false, target.word_properties.front().size)) + { + add_error<materialization_error>(literal->position()); + } break; } } |
