mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Compiler assertion when defining a function with return type untyped_list #2368. In general, improve error message when ct types are return types.
This commit is contained in:
18
test/test_suite/compile_time/untyped_list_rtype.c3
Normal file
18
test/test_suite/compile_time/untyped_list_rtype.c3
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
macro $typeof({}) foo2() { return {}; }
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int a;
|
||||
}
|
||||
|
||||
fn $typeof(Foo.a) foo3() {} // #error: may not return a member reference
|
||||
|
||||
fn $typeof({}) foo() {} // #error: A function may not return an untyped list
|
||||
|
||||
fn int main()
|
||||
{
|
||||
foo2();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user