aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/name_analysis.cc15
1 files changed, 15 insertions, 0 deletions
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<constant_type>() != nullptr)
+ {
+ add_error<double_const_error>(expression->position());
+ }
this->current_type = type(std::make_shared<constant_type>(this->current_type));
}