Bug 24560 – dmd crash on imported function with default parameter containing `new`
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-05-23T22:38:53Z
Last change time
2024-06-02T10:29:59Z
Keywords
ice, ice-on-valid-code, pull
Assigned to
RazvanN
Creator
hsteoh
Comments
Comment #0 by hsteoh — 2024-05-23T22:38:53Z
Code:
```
// mod.d
class C { }
struct S
{
static void fun(C heur = new C) { }
}
// test.d
import mod;
void main()
{
S.fun();
}
```
Compile command: dmd test.d
Compiler output:
```
Segmentation fault
```
Comment #1 by hsteoh — 2024-05-23T22:40:14Z
This bug has existed at least since 2.108.1, since ldc2 1.38.0, which is based on 2.108.1, shows the same problem (segfault upon compiling the above code).
Changed to regression: code compiles with 2.107.1.
Comment #4 by razvan.nitu1305 — 2024-05-24T07:57:35Z
The import is not necessary. Having the code in a single file also segfaults:
class C { }
struct S
{
static void fun(C heur = new C) { }
}
void main()
{
S.fun();
}
Comment #5 by dlang-bot — 2024-05-24T09:48:40Z
@RazvanN7 created dlang/dmd pull request #16519 "Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new" fixing this issue:
- Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new
https://github.com/dlang/dmd/pull/16519
Comment #6 by dlang-bot — 2024-05-27T08:33:26Z
dlang/dmd pull request #16519 "Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new" was merged into stable:
- 2afa92c00a5f04604ac8834a48c7cbb3ba605e2d by RazvanN7:
Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new
https://github.com/dlang/dmd/pull/16519
Comment #7 by dlang-bot — 2024-06-02T10:29:59Z
dlang/dmd pull request #16553 "merge stable" was merged into master:
- ee4f5a04ffa272cf9c9fa4a134fc71559d0851b3 by RazvanN7:
Fix Bugzilla Issue 24560 - dmd crash on imported function with default parameter containing new
https://github.com/dlang/dmd/pull/16553