www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19713] New: dmd crashes generating code for C++ template

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

--
Mar 01 2019