Bug 18028 – Allow Unnecessary Template Instantiation To Be Dropped

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-03T21:55:58Z
Last change time
2017-12-10T05:54:18Z
Assigned to
No Owner
Creator
Jack Stouffer

Comments

Comment #0 by jack — 2017-12-03T21:55:58Z
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.
Comment #1 by issues.dlang — 2017-12-10T05:54:18Z
*** This issue has been marked as a duplicate of issue 1012 ***