Bug 12674 – alias parameter does not accept specAlias and defaultAlias when both are types

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-28T18:47:00Z
Last change time
2014-04-28T20:34:39Z
Keywords
rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2014-04-28T18:47:38Z
----- template TemplVals( alias AliasParamSpecVal : 1, alias AliasParamDefaultVal = 1, alias AliasParamSpecDefaultVal : 1 = 2, ) { } template TemplTypes( alias AliasParamSpecType : int, alias AliasParamDefaultType = int, alias AliasParamSpecDefaultType : long = int, // syntax error ) { } void main() { alias a = TemplVals!(1, 1, 1); // ok alias b = TemplVals!(1); // ok alias c = TemplTypes!(int, int, int); // should be ok alias d = TemplTypes!(int); // should be ok } ----- Note that Type parameters work for the above test: ----- template TemplVals( alias AliasParamSpecVal : 1, alias AliasParamDefaultVal = 1, alias AliasParamSpecDefaultVal : 1 = 2, ) { } template TemplTypes( /* alias */ TypeParamSpecType : int, /* alias */ TypeParamDefaultType = int, /* alias */ TypeParamSpecDefaultType : long = int, ) { } void main() { alias a = TemplVals!(1, 1, 1); // ok alias b = TemplVals!(1); // ok alias c = TemplTypes!(int, int, int); // ok alias d = TemplTypes!(int); // ok } -----
Comment #1 by andrej.mitrovich — 2014-04-28T18:55:01Z
Sorry, I completely forgot alias does not accept types. I wish semantic checks and diagnostics were emitted in the declaration, and not the call.
Comment #2 by andrej.mitrovich — 2014-04-28T20:34:39Z
(In reply to Andrej Mitrovic from comment #1) > Sorry, I completely forgot alias does not accept types. I wish semantic > checks and diagnostics were emitted in the declaration, and not the call. Looks like this is filed as Issue 9698