Bug 13768 – Refused template method instantiation with enum struct field

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-11-23T13:20:56Z
Last change time
2018-07-25T18:47:40Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-11-23T13:20:56Z
struct Foo { immutable x = 0; void bar(int y)() {} } void main() { enum f = Foo(); enum x2 = f.x; f.bar!(x2); // OK f.bar!(f.x); // Error } dmd 2.067alpha: test.d(9,6): Error: template instance bar!(x) does not match template declaration bar(int y)()
Comment #1 by ag0aep6g — 2018-07-25T18:47:40Z
Works for me since 2.078.1. https://run.dlang.io/is/3t8nLy