mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Allow inference across && #2172.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
- Implicitly convert from constant typeid to Type in `$Type` assignment, and `$assignable`.
|
||||
- Make $Type parameters accept constant typeid values.
|
||||
- Deprecate `foo.#bar`.
|
||||
- Allow inference across `&&` #2172.
|
||||
|
||||
### Fixes
|
||||
- `-2147483648`, MIN literals work correctly.
|
||||
|
||||
@@ -10965,6 +10965,12 @@ RETRY:
|
||||
case EXPR_CT_ARG:
|
||||
if (!sema_expr_analyse_ct_arg(context, to, expr)) return expr_poison(expr);
|
||||
break;
|
||||
case EXPR_UNARY:
|
||||
if (expr->unary_expr.operator == UNARYOP_TADDR && to->canonical->type_kind == TYPE_POINTER && to->canonical != type_voidptr)
|
||||
{
|
||||
if (!sema_analyse_inferred_expr(context, type_get_indexed_type(to), expr->unary_expr.expr)) return expr_poison(expr);
|
||||
}
|
||||
FALLTHROUGH;
|
||||
default:
|
||||
if (!sema_analyse_expr_dispatch(context, expr, CHECK_VALUE)) return expr_poison(expr);
|
||||
break;
|
||||
|
||||
@@ -11,13 +11,15 @@ extern fn int printf(char *c, ...);
|
||||
fn void foo()
|
||||
{
|
||||
int z = 2;
|
||||
Foo*? w = &&{ z, 0 }; // #error: An untyped list can only have constant elements
|
||||
ushort* y = &&4;
|
||||
Foo*? w2 = &&{ z, 0 };
|
||||
void*? w = &&{ z, 0 }; // #error: An untyped list can only have constant elements
|
||||
}
|
||||
|
||||
fn void foo2()
|
||||
{
|
||||
int? z = 2;
|
||||
Foo*? w = &&{ z, 0 }; // #error: An untyped list can only have constant elements
|
||||
void*? w = &&{ z, 0 }; // #error: An untyped list can only have constant elements
|
||||
}
|
||||
|
||||
fn void test()
|
||||
|
||||
Reference in New Issue
Block a user