https://dlang.org/spec/function.html#typesafe_variadic_functions Class objects can be allocated on the stack, so a typesafe variadic class parameter should automatically be scope. @safe: class C { int x; } ref int g(scope C c ...) { return c.x; } correctly issues error: scope variable `c` may not be returned but, ref int g(scope C c ...) { return c.x; } erroneously compiles without error.
Oops, the second example should be: > ref int g(C c ...) { > return c.x; > }
@WalterBright created dlang/dmd pull request #13714 "fix Issue 22818 - typesafe variadic function parameter of type class …" fixing this issue: - fix Issue 22818 - typesafe variadic function parameter of type class should be scope https://github.com/dlang/dmd/pull/13714
dlang/dmd pull request #13714 "fix Issue 22818 - typesafe variadic function parameter of type class …" was merged into master: - c6fba23e8ddeddb7ebe8f83fd410283f35e24ede by Walter Bright: fix Issue 22818 - typesafe variadic function parameter of type class should be scope https://github.com/dlang/dmd/pull/13714