http://d.puremagic.com/issues/show_bug.cgi?id=9563
--- Comment #3 from [email protected] 2013-02-22 07:35:52 PST --- > What do you mean "only the class one works"? I'm getting a failure for both > asserts. I am not with DMD 2.062. This code compiles without any error and prints "int": template ElemTypeOf( T ) { alias typeof(T[0]) ElemTypeOf; } class A { int opIndex(size_t i) { return 0; } } void main() { ElemTypeOf!(A) a; pragma(msg, typeof(a).stringof); static assert(is(typeof(a) == int)); } > This worked in 2.060, but was fixed starting in 2.061. > > Try something like this: > > template ElemTypeOf( T ) > { > static private T t = T.init; > alias typeof(t[0]) ElemTypeOf; > } I guess that works (with some simplification of course), although the existence of a workaround does not negate the existence of the regression. > Or better yet, std.range's ElementType or ElementEncodingType. Not using Phobos. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
