[Issue 7124] Alias this type is not considered in template type deduction
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Dec 17 01:48:47 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7124
Kenji Hara <k.hara.pg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Alias this doesn |Alias this type is not
| |considered in template
| |type deduction
--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2011-12-17 01:48:44 PST ---
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]));
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list