How to fix "typesafe variadic function parameter"?

Andrey Zherikov andrey.zherikov at gmail.com
Tue May 24 22:46:55 UTC 2022


How to fix this?
```d
struct S
{
	string[] s;
}

auto foo(string[] s...)   // Error: typesafe variadic function 
parameter `s` of type `string[]` cannot be marked `return`
{
	return S(s);
}

void main()
{
	import std.stdio: writeln;

	writeln(foo("Hello D"));
}
```

This successfully compiles with dmd 2.099.1 but fails with 2.100.0

I tried to add `return`/`ref` but no luck.


More information about the Digitalmars-d-learn mailing list