is(...) with alias this
Zhenya
zheny at list.ru
Sat Jan 5 12:35:27 PST 2013
Hi!
I just read the David's post
http://forum.dlang.org/thread/kc9e74$bg7$1@digitalmars.com
"
This code worked with dmd 2.060:
import std.stdio;
import std.traits;
struct OhWhy(S) {
S[] arr;
alias arr this;
}
void main() {
static assert(isArray!(OhWhy!(float)));
}
But fails with dmd 2.061:
ss.d(10): Error: static assert (isArray!(OhWhy!(float))) is false
(same happens with alias this to static arrays and
isArray/isStaticArray)
Is this intended or a regression? If latter, I'll submit a
bug-ticket.
"
When I read this I understood that I don't know what should return
is(OhWhy!float unused == T[],T)
Of course OhWhy!float implicit convertable into float[].But on
the other hand
is with == (not :) should check the type without conversions.
What do you think?
DMD 2.060 HEAD evaluate is(OhWhy!float unused == T[],T) -> true
More information about the Digitalmars-d-learn
mailing list