PLEASE EXPLAIN THE SPEC: alias type specialization

Russell Lewis webmaster at villagersonline.com
Tue Mar 11 14:16:04 PDT 2008


I have a set of templates which take alias parameters, and I want to 
specialize them based on the type of the aliased symbols.

So I looked at 
http://digitalmars.com/d/2.0/template.html#TemplateAliasParameter and 
saw the following grammar (but no matching example):

TemplateAliasParameter:
	alias Identifier
	alias Identifier TemplateAliasParameterSpecialization
	alias Identifier TemplateAliasParameterDefault
	alias Identifier TemplateAliasParameterSpecialization 
TemplateAliasParameterDefault

TemplateAliasParameterSpecialization:
	 : Type

TemplateAliasParameterDefault:
	 = Type


So I wrote this code, which DMD rejects:
	template foo(alias A : int) {}


How is this supposed to work?  Or, is this a DMD bug?

Russ



More information about the Digitalmars-d mailing list