www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14883] New: static if does not work although an is expression

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

          Issue ID: 14883
           Summary: static if does not work although an is expression
                    produces 'true'
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pastuhov85 gmail.com

D 2.068.0-rc1

static if does not work although an is expression produces 'true'

import std.stdio;

auto foo(T)(T)
{
    return 42;
}

struct Vector(T)
{
    pragma(msg, is(typeof(foo(Vector.init))));    // prints true

    static if(is(typeof(foo(Vector.init)))) {
        static assert(false);                     // is not included
    }
}

void main()
{
    Vector!float v;
}

Related topic:
http://forum.dlang.org/thread/dlwevkweklswcfxykurg forum.dlang.org

--
Aug 07 2015