Bug 4097 – Error: can only declare type aliases within static if conditionals

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-04-16T09:03:00Z
Last change time
2011-04-07T15:49:33Z
Assigned to
nobody
Creator
nfxjfg

Comments

Comment #0 by nfxjfg — 2010-04-16T09:03:52Z
Look at this code: ---------------- void foo() { } alias typeof(&foo) T; // works static if (is(T X : X*) && is(X == function)) {} else { static assert(false); } // doesn't work // Error: can only declare type aliases within static if conditionals static assert(is(T X : X*) && is(X == function)); ---------------- This looks really silly. Couldn't that restriction be lifted? The alias would be only valid within the expression and wouldn't require a static if.
Comment #1 by bugzilla — 2011-04-07T15:49:33Z