Allow var in lambdas in macros. Allow ad hoc generic declaration in lambdas and type definitions. Fix deprecation flag.

This commit is contained in:
Christoffer Lerno
2024-09-09 21:46:06 +02:00
parent 32cc4bcd03
commit df4eb3d0f0
9 changed files with 22 additions and 10 deletions

View File

@@ -3788,7 +3788,7 @@ bool sema_analyse_var_decl(SemaContext *context, Decl *decl, bool local)
SEMA_ERROR(decl, "Constants need to have an initial value.");
return decl_poison(decl);
}
if (kind == VARDECL_LOCAL && !context->current_macro)
if (kind == VARDECL_LOCAL && !context_is_macro(context))
{
SEMA_ERROR(decl, "Defining a variable using 'var %s = ...' is only allowed inside a macro.", decl->name);
return decl_poison(decl);