https://issues.dlang.org/show_bug.cgi?id=14756
Kenji Hara k.hara...@gmail.com changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Kenji Hara k.hara...@gmail.com ---
(In reply to Tim from comment #0)
This behavior change is an intentional bug fix. See issue 14290.
enum bool isInstanceOf(alias S, T) = is(T == S!Args, Args...);
struct Test(size_t id)
{
static void from(Other)(Other other)
if (isInstanceOf!(Test, Other))
In here, 'Test' represents an instantiated struct, not a template. By fixing
issue 14290, is-expression won't match to the instantiation form S!Args when S
is a struct.
If the template constraint uses the is-expression directly, the error goes
away.
When you rewrite the condition as follows:
static void from(Other)(Other other)
if (is(Other == Test!Args, Args...))
'Test' is still a struct, but in here, the is-expression can recognize it may
also represent the outer template Test(size_t id) because it's accessible
through the lexical scope.
To fix the issue, you need to pass explicitly the template 'Test' to the
isInstanceOf.
struct Test(size_t id)
{
static void from(Other)(Other other)
if (isInstanceOf!(.Test, Other))
// -- Use Module Scope Operator (http://dlang.org/module)
{}
}
--