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