When a global const has invalid attributes, handling is incorrect, leading to a crash #2785.

This commit is contained in:
Christoffer Lerno
2026-01-21 00:43:30 +01:00
parent 472124dab3
commit 5fa820a462
3 changed files with 3 additions and 1 deletions

View File

@@ -28,6 +28,7 @@
- Failed to reject void compile time variables, leading to crash. #2781
- Inferring the size of a slice with an inner inferred array using {} isn't detected as error #2783
- Bug in sysv abi when passing union in with floats #2784
- When a global const has invalid attributes, handling is incorrect, leading to a crash #2785.
### Fixes
- Regression with npot vector in struct triggering an assert #2219.

View File

@@ -1007,7 +1007,7 @@ Decl *parse_const_declaration(ParseContext *c, bool is_global, bool is_extern)
// Differentiate between global and local attributes, global have visibility
if (is_global)
{
if (!parse_attributes_for_global(c, decl)) return false;
if (!parse_attributes_for_global(c, decl)) return poisoned_decl;
}
else
{

View File

@@ -0,0 +1 @@
const A @if(; // #error: An expression was expected.