Bug 7124 – Alias this type is not considered in template type deduction

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-12-17T01:45:00Z
Last change time
2012-01-03T21:09:36Z
Keywords
patch
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-12-17T01:45:12Z
Comment #1 by k.hara.pg — 2011-12-17T01:48:44Z
Following code doesn't compile. ---- template StaticArrayOf(T : E[dim], E, size_t dim) { pragma(msg, "T = ", T, ", E = ", E, ", dim = ", dim); alias E[dim] StaticArrayOf; } template DynamicArrayOf(T : E[], E) { pragma(msg, "T = ", T, ", E = ", E); alias E[] DynamicArrayOf; } template AssocArrayOf(T : V[K], K, V) { pragma(msg, "T = ", T, ", K = ", K, ", V = ", V); alias V[K] AssocArrayOf; } void main() { struct SA { int[5] sa; alias sa this; } static assert(is(StaticArrayOf!SA == int[5])); struct DA { int[] da; alias da this; } static assert(is(DynamicArrayOf!DA == int[])); struct AA { int[string] aa; alias aa this; } static assert(is(AssocArrayOf!AA == int[string])); }
Comment #2 by k.hara.pg — 2011-12-17T02:47:06Z
Comment #3 by k.hara.pg — 2012-01-03T21:09:36Z