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:
Christoffer Lerno
2025-08-05 04:11:54 +02:00
parent 229fdd6193
commit 00b88a8027
7 changed files with 46 additions and 13 deletions

View 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;
}