D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16164 - struct(class)'s template is difficult to use the default type
Summary: struct(class)'s template is difficult to use the default type
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P1 trivial
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-11 17:14 UTC by Tsukasa Sugawara
Modified: 2020-05-09 15:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tsukasa Sugawara 2016-06-11 17:14:29 UTC
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 Tsukasa Sugawara 2016-06-11 18:01:57 UTC
I received advice;
 " rewrite S to S!() "

work correctly, since I will change state to trivial.