[Issue 3650] New: functions are considered pointers

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 26 09:45:35 PST 2009


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

           Summary: functions are considered pointers
           Product: D
           Version: 1.051
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


--- Comment #0 from nfxjfg at gmail.com 2009-12-26 09:45:34 PST ---
First off, this bug report is for dmd 1.053, not 1.051; but bugzilla let's me
only select up to 1.051.

The following code outputs "what (void())()", which shows that function
pointers are matched with is(T T2 : T2*). I think this shouldn't be the case:
although technically function pointers really are pointers, D doesn't declare
them using the pointer syntax, doesn't allow them to be dereferenced, and they
don't point to any type.

If this bug is fixed, functions won't match with is(T T2 : T2*) anymore.

If this is just an anti-feature and not a bug, please mark this bug report as
"invalid".

struct X {
    void function() foo;
}

void moo(T)() {
    static if (is(T T2 : T2*)) {
        pragma(msg, "what "~T2.stringof);
    }
}

void main() {
    X x;
    foreach (int index, z; x.tupleof) {
        moo!(typeof(z));
    }
}

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