Issue 24883 - Speculative template overload error escapes with `-preview=rvaluerefparam`
Summary: Speculative template overload error escapes with `-preview=rvaluerefparam`
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-11-26 09:51 UTC by Dennis
Modified: 2024-11-29 07:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dennis 2024-11-26 09:51:03 UTC
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.
Comment 1 Dlang Bot 2024-11-26 10:40:19 UTC
@dkorpel created dlang/dmd pull request #17096 "Fix bugzilla 24883 - Speculative template overload error escapes with…" fixing this issue:

- Fix bugzilla 24883 - Speculative template overload error escapes with `-preview=rvaluerefparam`

https://github.com/dlang/dmd/pull/17096
Comment 2 Dlang Bot 2024-11-29 07:36:20 UTC
dlang/dmd pull request #17096 "Fix bugzilla 24883 - Speculative template overload error escapes with…" was merged into master:

- 6080c191001b0a7400b804e56ba391ddee800474 by Dennis Korpel:
  Fix bugzilla 24883 - Speculative template overload error escapes with `-preview=rvaluerefparam`

https://github.com/dlang/dmd/pull/17096