Bug 24752 – betterC memset link errors with template+array
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-09-08T11:02:43Z
Last change time
2024-09-09T10:26:09Z
Assigned to
No Owner
Creator
tg
Comments
Comment #0 by b42 — 2024-09-08T11:02:43Z
Possibly related to other array `memset` errors already reported before. The following code fails to link with `dmd` but works fine with `ldc2` on:
- Void Linux
- DMD64 D Compiler v2.101.1
- Args: `-betterC`
```
void fn(T, int N)(const T[N] arr) {
}
extern (C) void main() {
fn([1, 2]);
fn([1, 2, 3]);
fn([1, 2, 2]);
// same size array with different values fails
}
```
source/bug.d:(.text.main[main]+0x60): undefined reference to `_memset32'
Comment #1 by nick — 2024-09-08T20:47:09Z
Works for me with DMD64 D Compiler v2.109.0 on Linux Mint.
Comment #2 by b42 — 2024-09-09T10:23:50Z
I just tested again with DMD64 D Compiler v2.104.2 on Alpine Linux and
with DMD64 D Compiler v2.109.1 on Void Linux, they both work. I should have tested with a more recent version first. Sorry about that.