[Issue 6738] New: Can't call templatized property function from within a struct/class method
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Sep 27 17:38:18 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6738
Summary: Can't call templatized property function from within a
struct/class method
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-09-27 17:37:44 PDT ---
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. :/
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list