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

           Summary: DMD Segfault when forward-referencing pure auto-return
                    member function with parameter.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-valid-code, rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: kenn...@gmail.com
            Blocks: 340


--- Comment #0 from kenn...@gmail.com 2011-05-06 08:44:05 PDT ---
Test case:

---------------------------
import std.c.stdio;
int a() {
    return V.s(0);
}
struct V {
    static pure auto s(int x) {
        return 55;
    }
}
void main() {
    printf("%d\n", a());
}
---------------------------
Bus error
---------------------------

The bug appears only if all of the following conditions are met:
 1. The function 's' must be 'pure'. 
 2. The function 's' must have auto-return.
 3. The function 's' must have at least one named parameter. For example, if
    the parameter is changed to 'pure auto s(...)' the bug disappears.
 4. The function 's' must be placed after its first use. For example, moving
    'struct V' above 'int a()' the bug disappears.

The program works correctly in 2.048. Therefore I have marked this as a
regression.

============================

If instead of calling the function, we just compute the pointer of 's', we'll
get a forward reference error instead:

---------------------------
void a() {
    cast(void)(&V.s);
}
struct V {
    static pure auto s(int x) {
        return 0;
    }
}
---------------------------
x.d(2): Error: forward reference to s
---------------------------

But this error also happens on 2.048.

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

Reply via email to