Enum attributes would be overwritten by enum value attributes.

This commit is contained in:
Christoffer Lerno
2024-09-19 23:02:06 +02:00
parent ff36380ddf
commit 2fec1c83a4
3 changed files with 3 additions and 2 deletions

View File

@@ -40,6 +40,7 @@
- Temp allocator overwrites data when doing reset on extra allocated pages. #1462
- User defined attributes could not have more than 1 parameter due to bug.
- Folding a constant array of structs at compile time would cause an assert.
- Enum attributes would be overwritten by enum value attributes.
### Stdlib changes
- Additional init functions for hashmap.

View File

@@ -1498,7 +1498,7 @@ static inline bool sema_analyse_enum(SemaContext *context, Decl *decl, bool *era
Decl *enum_value = enum_values[i];
bool erase_val = false;
if (!sema_analyse_attributes(context, decl, enum_value->attributes, ATTR_ENUM, &erase_val)) return decl_poison(decl);
if (!sema_analyse_attributes(context, enum_value, enum_value->attributes, ATTR_ENUM_VALUE, &erase_val)) return decl_poison(decl);
if (erase_val)
{

View File

@@ -59,5 +59,5 @@ fn void main()
@test.BAZ2 = local_unnamed_addr constant i32 2, align 4
@test.ABC = local_unnamed_addr constant [1 x %TestUnion] [%TestUnion { i32 112 }], align 4
@test.BCD = local_unnamed_addr constant %TestUnion { i32 112 }, align 4
@test.MY_VALUE_1 = local_unnamed_addr constant i32 -1, align 4
@test.MY_VALUE_1 = local_unnamed_addr constant i32 32, align 4
@test.MY_VALUE_2 = local_unnamed_addr constant i32 32, align 4