[Issue 11303] New: IsExpression can not return the correct result about function & delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 19 23:24:52 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11303

           Summary: IsExpression can not return the correct result about
                    function & delegate
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: 786325481 at QQ.com


--- Comment #0 from Xuchong <786325481 at QQ.com> 2013-10-19 23:24:48 PDT ---
Sorry for my poor English.

I find that IsExpression can not return the correct result about function &
delegate.

Sample like that:

unittest
{
    static int test(int x)
    {
        return x * 2;
    }

    auto fn1 = &test;
    auto fn2 = (int x) { return x * 2; };
    auto fn3 = (int x) { return x * 2; };
    auto fn4 = (int x) => x * 2;
    auto fn5 = function (int x) => x * 2;
    auto fn6 = function (int x) { return x * 2; };

    static assert(is(typeof(fn1) == function));
    static assert(is(typeof(fn2) == function));
    static assert(is(typeof(fn3) == function));
    static assert(is(typeof(fn4) == function));
    static assert(is(typeof(fn5) == function));
    static assert(is(typeof(fn6) == function));
}

IsExpression always return false, but the correct result is true.

My environment :

OS : Win8.1 Preview x64
Compiler: dmd2 2.063.2 & dmd2 2.064 beta
IDE : Mono-D

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list