Bug 20224 – Segfault when using ref parameter on a templated struct (C++ mangling)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2019-09-18T01:58:12Z
Last change time
2019-09-23T09:53:48Z
Keywords
pull
Assigned to
No Owner
Creator
Andrej Mitrovic
Comments
Comment #0 by andrej.mitrovich — 2019-09-18T01:58:12Z
extern(C++) public int foo(T)(set!T set); // ok
extern(C++) public int bar(T)(ref set!T set); // segfault
struct set (T)
{
void test ()
{
foo!T(this);
bar!T(this); // segfaults
}
}
void main ()
{
set!int x;
}
Comment #1 by dlang-bot — 2019-09-18T02:31:13Z
@Geod24 updated dlang/dmd pull request #10417 "Fix issue 20223: Wrong mangling for const reference of callback" fixing this issue:
- Fix issue 20224: Segfault when using ref parameter on a templated struct (C++ mangling)
The previous commit actually fixes the issue, this simply adds the test from the issue
https://github.com/dlang/dmd/pull/10417
Comment #2 by dlang-bot — 2019-09-23T09:53:48Z
dlang/dmd pull request #10417 "Fix issue 20223 + 20224: Wrong mangling for const reference of callback" was merged into stable:
- c23c2cecb08cb44b00577be28fde91b09e7c07bd by Geod24:
Fix issue 20223, 20224: Wrong mangling for const reference
In addition to the wrong mangling, the substitution pool needed to be adjusted.
https://github.com/dlang/dmd/pull/10417