aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-03-15 19:01:36 +0000
committergingerBill <bill@gingerbill.org>2019-03-15 19:01:36 +0000
commit716373836ca8139a952b79a6df2a67fd22b7c2c8 (patch)
tree5479e75f5c1ca173e232c86963add1ae30e96d0e
parentfdb60b2d511f99dd9b8b427d032333992b10fd6a (diff)
Disallow attributes on alias declarations
-rw-r--r--src/check_decl.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp
index c2796e1da..3f5ef042f 100644
--- a/src/check_decl.cpp
+++ b/src/check_decl.cpp
@@ -391,8 +391,18 @@ void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init,
case Entity_Procedure:
case Entity_LibraryName:
case Entity_ImportName:
- override_entity_in_scope(e, entity);
- return;
+ {
+ override_entity_in_scope(e, entity);
+
+ DeclInfo *decl = decl_info_of_entity(e);
+ if (decl != nullptr) {
+ if (decl->attributes.count > 0) {
+ error(decl->attributes[0], "Constant alias declarations cannot have attributes");
+ }
+ }
+
+ return;
+ }
}
}
}