[Issue 11012] New: [TDPL] is(typeof(f) == function) fails with some functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 11 12:34:21 PDT 2013


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

           Summary: [TDPL] is(typeof(f) == function) fails with some
                    functions
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at erdani.com


--- Comment #0 from Andrei Alexandrescu <andrei at erdani.com> 2013-09-11 12:34:19 PDT ---
Consider TDPL example om page 150:

auto f = (int i) {};
assert(is(f == function));

That example has a typo, should be:

auto f = (int i) {};
assert(is(typeof(f) == function));

That still doesn't work, which brings us to this bug. The type of the function
is deduced as

void function(int i) pure nothrow @safe

and that fails the "is" test when compared against the bare "function" keyword.
As "function" by itself does not represent a type, the test should pass for all
functions, however qualified.

-- 
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