Skip to content

Commit

Permalink
Deprecate $varef.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Jan 8, 2025
1 parent 214e806 commit 8fb3ec7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/compiler/sema_expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions test/test_suite/macros/macro_untyped_varargs_2.c3t
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 8fb3ec7

Please sign in to comment.