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.
Comment #1 by dlang-bot — 2024-11-26T10:40:19Z
@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 by dlang-bot — 2024-11-29T07:36:20Z
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