Bug 22208 – [REG 2.067] Overload resolution fails to bind immutable class-valued AA to inout parameter of template function

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-08-13T11:30:56Z
Last change time
2024-12-13T19:18:03Z
Assigned to
No Owner
Creator
Paul Backus
Moved to GitHub: dmd#19973 →

Comments

Comment #0 by snarwin+bugzilla — 2021-08-13T11:30:56Z
As of DMD 2.097.0, the following program fails to compile: --- class Style {} immutable Style[int] gluiDefaultTheme; void makeTheme()() {} void makeTheme()(inout(Style[int]) parent) {} void main() { makeTheme!()(gluiDefaultTheme); } --- The error message is: --- onlineapp.d(11): Error: template `onlineapp.makeTheme` cannot deduce function from argument types `!()(immutable(Style[int]))`, candidates are: onlineapp.d(5): `makeTheme()()` onlineapp.d(7): `makeTheme()(inout(Style[int]) parent)` --- Making any of the following changes causes the program to compile successfully: * Changing Style from a class to a struct. * Changing gluiDefaultTheme from immutable to mutable. * Changing the type of gluiDefaultTheme from Style[int] to Style[]. * Removing the empty template parameter lists from makeTheme's overloads and removing the empty template argument list from the call in main. According to run.dlang.io, this program: * Failed to compile prior to DMD 2.065.0 * Compiled successfully with DMD 2.065.0 and 2.066.0 * Failed to compile again starting with DMD 2.067.1 So, this is a regression introduced in DMD 2.067.
Comment #1 by snarwin+bugzilla — 2021-08-13T12:07:44Z
According to digger, this was introduced by https://github.com/dlang/dmd/pull/3896
Comment #2 by robert.schadek — 2024-12-13T19:18:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19973 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB