Bug 24883 – Speculative template overload error escapes with `-preview=rvaluerefparam`
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-11-26T09:51:03Z
Last change time
2024-11-29T07:36:20Z
Keywords
pull
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2024-11-26T09:51:03Z
With -preview=rvaluerefparam, this raises an error:
```D
int toString(Writer)(ref Writer sink) => 3;
int toString(void delegate(scope const(char)[]) sink) => 4;
void put() {}
pragma(msg, toString(dst => put()));
```
```
onlineapp.d(1): Error: cannot have parameter of type `void`
4
```
The error from trying to instantiate toString with `Writer = void` should be ignored since that overload isn't picked.