Prevent ct_eval from returning an rvalue.

This commit is contained in:
Christoffer Lerno
2022-10-04 22:41:07 +02:00
parent 3d844b8722
commit eb86b83bd7
4 changed files with 12 additions and 3 deletions

View File

@@ -6242,11 +6242,10 @@ static inline bool sema_expr_analyse_ct_eval(SemaContext *context, Expr *expr)
case TOKEN_IDENT: case TOKEN_IDENT:
case TOKEN_CONST_IDENT: case TOKEN_CONST_IDENT:
expr->expr_kind = EXPR_IDENTIFIER; expr->expr_kind = EXPR_IDENTIFIER;
expr->resolve_status = RESOLVE_NOT_DONE;
expr->identifier_expr.ident = ident; expr->identifier_expr.ident = ident;
expr->identifier_expr.path = path; expr->identifier_expr.path = path;
expr->identifier_expr.is_const = type == TOKEN_CONST_IDENT; expr->identifier_expr.is_const = type == TOKEN_CONST_IDENT;
return sema_analyse_expr(context, expr); return sema_analyse_expr_dispatch(context, expr);
default: default:
SEMA_ERROR(inner, "Only function, variable and constant names may be resolved with $eval."); SEMA_ERROR(inner, "Only function, variable and constant names may be resolved with $eval.");
return false; return false;

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.3.66" #define COMPILER_VERSION "0.3.67"

View File

@@ -0,0 +1,5 @@
fn int test()
{
void* x = (void*)&$eval($$FUNC);
return 1;
}

View File

@@ -0,0 +1,5 @@
fn int test()
{
void* x = (void*)&$eval($$FUNC);
return 1;
}