[Issue 13767] Template type inference fails when destructuring shared type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 1 18:52:30 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=13767

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dlang-bugzilla at thecybershad
                   |                            |ow.net
         Resolution|---                         |INVALID

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
No, because you use ==, which does exact matching. If you want to partially
match the type (i.e. check if it's implicitly convertible to shared), use `:`,
not `==`:

shared const int i;

static if (is(typeof(i) == shared U, U))
{
    pragma(msg, U); // now prints const(int)
}

void main()
{
}

--


More information about the Digitalmars-d-bugs mailing list