Deprecate $varef.

This commit is contained in:
Christoffer Lerno
2025-01-08 23:56:10 +01:00
parent 214e806a33
commit 8fb3ec73ff
2 changed files with 4 additions and 3 deletions

View File

@@ -9158,6 +9158,7 @@ static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Type *infer_ty
}
case TOKEN_CT_VAREF:
{
SEMA_DEPRECATED(expr, "'$varef' is deprecated together with '&' arguments.");
// A normal argument, this means we only evaluate it once.
unsigned index = 0;
ASSIGN_EXPR_OR_RET(Expr *arg_expr, sema_expr_analyse_ct_arg_index(context, exprptr(expr->ct_arg_expr.arg), &index), false);

View File

@@ -34,9 +34,9 @@ macro foo3(...)
macro @foo4(...)
{
$typeof(*$varef[0]) a = *$varef[0];
*$varef[0] = *$varef[1];
*$varef[1] = a;
$typeof($vaexpr[0]) a = $vaexpr[0];
$vaexpr[0] = $vaexpr[1];
$vaexpr[1] = a;
}
fn int ping(int val)
{