From 349e84c693c1444606e877f4d8cdc1a39aa91634 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 17 Jul 2026 17:57:40 +0200 Subject: Reject const in const nesting --- boot/name_analysis.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'boot') diff --git a/boot/name_analysis.cc b/boot/name_analysis.cc index 48251cd..5255878 100644 --- a/boot/name_analysis.cc +++ b/boot/name_analysis.cc @@ -70,6 +70,16 @@ namespace elna::boot return "const must be written before the array size, not after"; } + double_const_error::double_const_error(const source_position position) + : error(position) + { + } + + std::string double_const_error::what() const + { + return "Duplicate 'const' qualifier is not allowed"; + } + // Members of a constant aggregate are constant themselves. static type qualify_member_type(const type& element, const type& aggregate) { @@ -179,6 +189,11 @@ namespace elna::boot void name_analysis_visitor::visit(constant_type_expression *expression) { walking_visitor::visit(expression); + + if (this->current_type.get() != nullptr) + { + add_error(expression->position()); + } this->current_type = type(std::make_shared(this->current_type)); } -- cgit v1.2.3