mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Empty struct after @if processing was not detected, causing a crash instead of an error.
- Comparing an uint and int[<4>] was incorrectly assumed to be uint compared to int, causing a crash instead of an error. - When an `int[*][6]` was given too few values, the compiler would assert instead of giving an error.
This commit is contained in:
@@ -387,7 +387,10 @@ static bool sema_analyse_union_members(SemaContext *context, Decl *decl)
|
||||
// Offset is always 0
|
||||
member->offset = 0;
|
||||
}
|
||||
|
||||
if (!member_count)
|
||||
{
|
||||
RETURN_SEMA_ERROR(decl, "No union members exist after processing attributes, this is not allowed. Please make sure it has at least one member.");
|
||||
}
|
||||
ASSERT(decl_ok(decl));
|
||||
|
||||
// 1. If packed, then the alignment is zero, unless previously given
|
||||
@@ -644,6 +647,11 @@ static bool sema_analyse_struct_members(SemaContext *context, Decl *decl)
|
||||
if (offset < sz || offset > MAX_STRUCT_SIZE) RETURN_SEMA_ERROR(member, "Struct member '%s' would cause the struct to become too large (exceeding 2 GB).", member->name);
|
||||
}
|
||||
|
||||
if (!member_count)
|
||||
{
|
||||
RETURN_SEMA_ERROR(decl, "No members exist for this struct after processing attributes, creating an invalid empty struct. Please make sure every struct/inner struct has at least one member.");
|
||||
}
|
||||
|
||||
// Set the alignment:
|
||||
|
||||
// 1. If packed, use the alignment given, otherwise set to 1.
|
||||
|
||||
Reference in New Issue
Block a user