Error when returning values within macro trailing bodies and block expressions #1889
Open
Description
Compiler throws an error when compiling such code:
// --- test.c3
fault SomeF
{
A, B, C
}
macro usz! @insertBody(;@body())
{
return {| @body(); |};
}
fn void main()
{
usz! res1 = @insertBody() { return SomeF.A?; };
}
Here is an error:
$ c3c compile-run test.c3
11:
12: fn void main()
13: {
14: usz! res1 = @insertBody() { return SomeF.A?; };
^^^^^^^^
(/home/starleks/coding/probe/c3-sandbox/main.c3:14:38) Error: It is not possible to cast
from 'void!' to 'void'.