www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23262] New: typesafe variadic function parameter cannot infer

https://issues.dlang.org/show_bug.cgi?id=23262

          Issue ID: 23262
           Summary: typesafe variadic function parameter cannot infer
                    return
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

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`.

--
Jul 20 2022