From 8fb3ec73ffbcb1fab2514c9a9bc12226188f1a76 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 8 Jan 2025 23:56:10 +0100 Subject: [PATCH] Deprecate $varef. --- src/compiler/sema_expr.c | 1 + test/test_suite/macros/macro_untyped_varargs_2.c3t | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index b13593e10..bdd3ed5ec 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -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); diff --git a/test/test_suite/macros/macro_untyped_varargs_2.c3t b/test/test_suite/macros/macro_untyped_varargs_2.c3t index c4e12f584..8621fb3ef 100644 --- a/test/test_suite/macros/macro_untyped_varargs_2.c3t +++ b/test/test_suite/macros/macro_untyped_varargs_2.c3t @@ -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) {