Bug 6738 – Can't call templatized property function from within a struct/class method

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-09-27T17:37:00Z
Last change time
2012-02-17T20:20:50Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-09-27T17:37:44Z
struct Foo { int _val; @property int val()() { return _val; } int get() { return val; } // fail } void main() { Foo bar; auto x = bar.val; // ok } Error: cannot implicitly convert expression (val()) of type void to int Note how I can call the property function without errors from outside Foo's methods, however from inside its methods I can't. The *real* issue here is that I can't overload templated and non-templated functions. In my own code I have a templated setter and want to use a non-templated getter. However that can't work right now due to bugs, so I'm forced to make the getter a template by adding an empty set of parens. But as you can see, this introduces yet another new bug. :/
Comment #1 by k.hara.pg — 2011-10-08T14:04:47Z
Comment #2 by andrej.mitrovich — 2011-10-08T15:15:07Z
It's absolutely fantastic that this is getting fixed. Major props!
Comment #3 by github-bugzilla — 2012-01-26T12:06:13Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1d4438f151143fcdcb807e257959dd1d588f9048 Issue 6738 - Can't call templatized property function from within a struct/class method
Comment #4 by bugzilla — 2012-02-14T00:31:41Z
Comment #5 by k.hara.pg — 2012-02-14T05:32:59Z
Comment #6 by github-bugzilla — 2012-02-17T19:39:46Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/63dd3e18b32acaf31da81d91bbb10ea8b2aa0651 Merge pull request #715 from 9rnsr/fix6738 fix issue 6738 revisited