Bug 5426 – Property syntax fails with template function with template paramters but no function parameters and you have a setter

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2011-01-07T22:27:00Z
Last change time
2012-05-30T23:24:09Z
Keywords
rejects-valid
Assigned to
nobody
Creator
issues.dlang

Comments

Comment #0 by issues.dlang — 2011-01-07T22:27:24Z
This fails to compile: struct S { @property T func(T)() { return T.init; } @property void func(T)(T value) { } } void main() { S s; auto t = s.func!int; s.func!int = 2; } and it gives this error: l.d(16): Error: template instance func!(int) matches more than one template declaration, l.d(3):func(T) and l.d(8):func(T) If you use s.func!int(), it works. If you make it so that the setter function is no longer a property function, and you don't actually try and use the setter, then it works (though if you the try and use the non-property setter function, the property getter fails again). So, it looks like the property syntax is definitely broken for template which have a template parameter but no function parameter. This is likely related to bug# 5425, though I'm not at all sure that they're the same bug (since 5425 deals with a situation which works normally but not inside __traits).
Comment #1 by lovelydear — 2012-04-22T09:51:12Z
Compiles and runs with 2.059 win32.
Comment #2 by k.hara.pg — 2012-05-30T19:09:52Z
Works in 2.060head.
Comment #3 by doob — 2012-05-30T23:24:09Z
Awesome!