www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18028] New: Allow Unnecessary Template Instantiation To Be

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 puremagic.com
          Reporter: jack 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.

--
Dec 03 2017