Bug 1901 – Structs with alias template params not accepted as types in declarations

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-03-09T18:31:47Z
Last change time
2017-12-30T03:01:54Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
|

Comments

Comment #0 by dhasenan — 2008-03-09T18:31:47Z
A parse error, apparently: struct Test(alias test) { void run() { test(); } } struct Something(char[] s) { char[] name () { return s; } } alias Test!({ Stdout("test!").newline; }) test; // fine void main() { Something!(`hello`) thing; // fine test t; // fine Test!({ Stdout("test!").newline; }) z; // fail, error: //plan.d(30): found 'z' when expecting ';' following 'statement' } I was hoping to use this means as a brief way of declaring unit tests in an xUnit-like system (and iterate through them using .tupleof)
Comment #1 by dhasenan — 2008-03-09T18:32:45Z
Noticed this in 1.025 as well; not sure how old it is.