How is std.traits.isInstanceOf supposed to work?
Tommi
tommitissari at hotmail.com
Sun Nov 10 17:03:10 PST 2013
On Sunday, 10 November 2013 at 23:43:21 UTC, TheFlyingFiddle
wrote:
> The template isInstanceOf checks to see if the second parameter
> is a template instantiation of the first parameter.
But in this example of mine:
isInstanceOf!(SuperSt, SubSt)
...the second parameter is not a template instantiation of the
first parameter, yet isInstanceOf evaluates to true.
I think what this all boils down to is that this is a
compiler-bug:
struct A(T)
{}
struct B
{
A!int _a;
alias _a this;
}
void main()
{
static assert(!is(B == A!int)); // OK
static assert(is(B == A!T, T)); // BUG (shouldn't compile)
}
More information about the Digitalmars-d
mailing list