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

          Issue ID: 19713
           Summary: dmd crashes generating code for C++ template function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

This code compiles fine:

--------------------------
extern(C++) {
    double twice(double d) { return d * 2; }
    void* createFunction(double function(double));
}

void main() {
    const f = createFunction(&twice);
}
------------------------------


This crashes dmd 2.084.0:

--------------------------
extern(C++) {
    double twice(double d) { return d * 2; }
    void* createFunction(R)(R function(double));
}

void main() {
    const f = createFunction(&twice);
}
------------------------------

It doesn't crash with `dmd -o-` suggesting it's in the code generation. It also
doesn't crash if `extern(C++)` is removed.

--

Reply via email to