[Issue 18028] New: Allow Unnecessary Template Instantiation To Be Dropped

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 3 21:55:58 UTC 2017


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

          Issue ID: 18028
           Summary: Allow Unnecessary Template Instantiation To Be Dropped
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: jack at jackstouffer.com

With function templates, if the template argument(s) have default parameters,
the template parentheses doesn't have to be specified:

```
void func(T = float)() { }

void main()
{
        func();
}
```

However, this is not the case for structs: 

```
struct Test(T = float)
{
        T a;
}

void main()
{
        auto b = Test(); // Error: struct Test cannot deduce function from
argument types !()()

        auto c = Test!()(); // Compiles
}
```

There's no reason to force the user to use explicit template parentheses.
Please allow these to be dropped just like functions.

--


More information about the Digitalmars-d-bugs mailing list