diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-16 11:58:14 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-16 11:58:14 +0000 |
| commit | c819c350d62b2069adc36407a35cb12bd7066a25 (patch) | |
| tree | 91f3229beb5d32add30322c1faee59dc05caaef7 /src/check_expr.cpp | |
| parent | d55248ab0ffcf796cfdc4961e813e69b2c71b723 (diff) | |
Add error message for atomic intrinsics to prevent arbitrary types
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 491114344..431b36664 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4896,6 +4896,17 @@ gb_internal bool is_type_normal_pointer(Type *ptr, Type **elem) { return false; } +gb_internal bool is_type_valid_atomic_type(Type *elem) { + elem = core_type(elem); + if (elem->kind == Type_BitSet) { + elem = bit_set_to_int(elem); + } + if (elem->kind != Type_Basic) { + return false; + } + return (elem->Basic.flags & (BasicFlag_Boolean|BasicFlag_OrderedNumeric)) != 0; +} + gb_internal bool check_identifier_exists(Scope *s, Ast *node, bool nested = false, Scope **out_scope = nullptr) { switch (node->kind) { case_ast_node(i, Ident, node); |