Bug 24788 – Template inferrence bug?

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-10-02T23:40:27Z
Last change time
2024-12-13T19:37:42Z
Assigned to
No Owner
Creator
Manu
Moved to GitHub: dmd#18270 →

Comments

Comment #0 by turkeyman — 2024-10-02T23:40:27Z
void f(T)(const(T)[] x, const(T)* y) {} void test() { // this works; T is inferred as int int[] x; const int y; f(x, &y); // fails: expected that T is inferred as int* int*[] a; const int* b; f(a, &b); } Something about a/b being an arrangement of int* compared to x/y with int causes this to fail. I reckon the non-uniformity of this type deduction logic is a bug. This non-uniformity has caused me several problems with meta code. I think it's banging into an issue with const promotion; if you remove const from y and b, both cases work properly.
Comment #1 by robert.schadek — 2024-12-13T19:37:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18270 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB