[Issue 22208] New: [REG 2.067] Overload resolution fails to bind immutable class-valued AA to inout parameter of template function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 13 11:30:56 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22208
Issue ID: 22208
Summary: [REG 2.067] Overload resolution fails to bind
immutable class-valued AA to inout parameter of
template function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list