D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23262 - typesafe variadic function parameter cannot infer return
Summary: typesafe variadic function parameter cannot infer return
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-07-21 02:36 UTC by Walter Bright
Modified: 2022-07-23 16:39 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2022-07-21 02:36:02 UTC
struct T()
{
    string[] tags;

    this(string[] tags...)
    {
        this.tags = tags; // typesafe variadic function parameter `tags` of type `string[]` cannot be marked `return`
    }
}

void test()
{
    T!() t;
}

The trouble here is this(), being a template, gets attributes inferred. `return` is inferred for `tags`, which later on fails because such parameters cannot be `return`.
Comment 1 Dlang Bot 2022-07-21 02:40:28 UTC
@WalterBright created dlang/dmd pull request #14320 "fix Issue 23262 - typesafe variadic function parameter cannot infer r…" fixing this issue:

- fix Issue 23262 - typesafe variadic function parameter cannot infer return

https://github.com/dlang/dmd/pull/14320
Comment 2 Dlang Bot 2022-07-23 16:39:44 UTC
dlang/dmd pull request #14320 "fix Issue 23262 - typesafe variadic function parameter cannot infer r…" was merged into master:

- 29c66cf8c1e1112e678e30acf36d5d1fa687dc79 by Walter Bright:
  fix Issue 23262 - typesafe variadic function parameter cannot infer return

https://github.com/dlang/dmd/pull/14320