[Issue 19713] New: dmd crashes generating code for C++ template function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 1 14:51:09 UTC 2019


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: nobody at puremagic.com
          Reporter: atila.neves at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list