Bug 16164 – struct(class)'s template is difficult to use the default type

Status
RESOLVED
Resolution
INVALID
Severity
trivial
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-06-11T17:14:29Z
Last change time
2020-05-09T15:30:53Z
Assigned to
No Owner
Creator
Tsukasa Sugawara

Comments

Comment #0 by mixedavocado+dlang — 2016-06-11T17:14:29Z
void main(){ S s; } struct S( T = size_t ) { T buf; } > Error: struct temp.S(T = size_t) is used as a type difficult to understand because there is no relation of default Type, and difficult to notice rewriting S to S!size_t(work correctly). I think that DMD compiler should... use Template-Type-Parameter-Default and not return error (enh?bug?) or return error message about default value with above message (bug) or return error message easier (enh?bug?)
Comment #1 by mixedavocado+dlang — 2016-06-11T18:01:57Z
I received advice; " rewrite S to S!() " work correctly, since I will change state to trivial.