mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Non-const macros may not return untyped lists.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
- Missing bounds check on upper bound with const ranges `foo[1:3]`.
|
- Missing bounds check on upper bound with const ranges `foo[1:3]`.
|
||||||
- Check up the hierarchy when considering if an interface cast is valid #2267.
|
- Check up the hierarchy when considering if an interface cast is valid #2267.
|
||||||
- Fix issue with labelled break inside of a $switch.
|
- Fix issue with labelled break inside of a $switch.
|
||||||
|
- Non-const macros may not return untyped lists.
|
||||||
|
|
||||||
### Stdlib changes
|
### Stdlib changes
|
||||||
|
|
||||||
|
|||||||
@@ -2859,11 +2859,14 @@ EXIT:
|
|||||||
}
|
}
|
||||||
sema_context_destroy(¯o_context);
|
sema_context_destroy(¯o_context);
|
||||||
call_expr->resolve_status = RESOLVE_DONE;
|
call_expr->resolve_status = RESOLVE_DONE;
|
||||||
if (is_always_const && !expr_is_runtime_const(call_expr))
|
if (!expr_is_runtime_const(call_expr))
|
||||||
{
|
{
|
||||||
SEMA_ERROR(call_expr, "The macro failed to fold to a constant value, despite being '@const'.");
|
if (is_always_const)
|
||||||
SEMA_NOTE(decl, "The macro was declared here.");
|
{
|
||||||
return false;
|
SEMA_ERROR(call_expr, "The macro failed to fold to a constant value, despite being '@const'.");
|
||||||
|
SEMA_NOTE(decl, "The macro was declared here.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
EXIT_FAIL:
|
EXIT_FAIL:
|
||||||
|
|||||||
14
test/test_suite/compile_time/compile_time_untyped.c3
Normal file
14
test/test_suite/compile_time/compile_time_untyped.c3
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
struct Test
|
||||||
|
{
|
||||||
|
struct { int a; }
|
||||||
|
}
|
||||||
|
|
||||||
|
macro test(int x)
|
||||||
|
{
|
||||||
|
return {{}};
|
||||||
|
}
|
||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
Test a = test(3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user