mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
&&& was accidentally available as a valid prefix operator.
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
- Error when using named argument on trailing macro body expansion #2139.
|
- Error when using named argument on trailing macro body expansion #2139.
|
||||||
- Designated const initializers with `{}` would overwrite the parent field.
|
- Designated const initializers with `{}` would overwrite the parent field.
|
||||||
- Empty default case in @jump switch does not fallthrough #2147.
|
- Empty default case in @jump switch does not fallthrough #2147.
|
||||||
|
- `&&&` was accidentally available as a valid prefix operator.
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
- Added `String.quick_ztr` and `String.is_zstr`
|
- Added `String.quick_ztr` and `String.is_zstr`
|
||||||
|
|||||||
@@ -703,7 +703,13 @@ static Expr *parse_unary_expr(ParseContext *c, Expr *left)
|
|||||||
|
|
||||||
bool is_bangbang = tok_is(c, TOKEN_BANGBANG);
|
bool is_bangbang = tok_is(c, TOKEN_BANGBANG);
|
||||||
Expr *unary = EXPR_NEW_TOKEN(EXPR_UNARY);
|
Expr *unary = EXPR_NEW_TOKEN(EXPR_UNARY);
|
||||||
|
if (c->tok == TOKEN_CT_AND)
|
||||||
|
{
|
||||||
|
PRINT_ERROR_HERE("'&&&' is the compile time '&&' operator. If you want to take a temp address of an address, use () or space to clarify the intent, e.g. '&&(&a)'.");
|
||||||
|
return poisoned_expr;
|
||||||
|
}
|
||||||
unary->unary_expr.operator = unaryop_from_token(c->tok);
|
unary->unary_expr.operator = unaryop_from_token(c->tok);
|
||||||
|
ASSERT(unary->unary_expr.operator != UNARYOP_ERROR);
|
||||||
advance(c);
|
advance(c);
|
||||||
Expr *right_side = parse_precedence(c, PREC_UNARY);
|
Expr *right_side = parse_precedence(c, PREC_UNARY);
|
||||||
|
|
||||||
|
|||||||
10
test/test_suite/expressions/addr_fail_2.c3
Normal file
10
test/test_suite/expressions/addr_fail_2.c3
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import std;
|
||||||
|
|
||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
// This works
|
||||||
|
int** my_super_cool_pointer = &&(&&1);
|
||||||
|
// This doesn't
|
||||||
|
int** my_super_cool_pointer2 = &&&&1; // #error: '&&&' is the compile time '&&' operator
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user