Bug 19713 – dmd crashes generating code for C++ template function
Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-03-01T14:51:09Z
Last change time
2019-05-21T10:00:49Z
Keywords
C++, ice, ice-on-valid-code
Assigned to
No Owner
Creator
Atila Neves
Comments
Comment #0 by atila.neves — 2019-03-01T14:51:09Z
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.
Comment #1 by dlang-bot — 2019-05-21T10:00:49Z
dlang/dmd pull request #9826 " Fix issue 19713 - ICE on C++ template function" was merged into stable:
- 3b102c863e2bae809fe1fc6bb4da819a0d98fad2 by سليمان السهمي (Suleyman Sahmi):
Fix issue 19713 - ICE on C++ template function
https://github.com/dlang/dmd/pull/9826