digitalmars.D.bugs - [Issue 9121] New: Templated getters/setter for properties collision
- d-bugmail puremagic.com (53/53) Dec 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9121
- d-bugmail puremagic.com (11/11) Sep 09 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9121
http://d.puremagic.com/issues/show_bug.cgi?id=9121 Summary: Templated getters/setter for properties collision Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dmitry.olsh gmail.com --- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2012-12-07 05:07:32 PST --- Sample: struct A { size_t foo(){ length!1 = 22; //expect to call a setter return length!0; //expect to call a getter } property size_t length(size_t n)()const{ return n; } property void length(size_t n)(size_t new_size){ //set new size } } Instead of expected call issued the compiler spits out: prop_bug.d(5): Error: template prop_bug.A.length matches more than one template length(uint n)() and prop_bug.d(11):length(uint n)(size_t new_size) prop_bug.d(6): Error: template prop_bug.A.length matches more than one template declaration, prop_bug.d(9):length(uint n)() and prop_bug.d(11):length(uint n)(size_t new_size) Curiously if I (not using -property switch) change length!0 to length!0() it compiles. Tested on the dmd 2.061 from git-hub master 143e02d2b1fdb990cab3c6039c7459be3e90e142. Putting both in a single template also works i.e. the following: struct A { size_t foo(){ length!1 = 22; return length!0; } template length(size_t n) { property size_t length()const{ return n; } property void length(size_t new_size){ //set new size } } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9121 Dmitry Olshansky <dmitry.olsh gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WORKSFORME --- Comment #1 from Dmitry Olshansky <dmitry.olsh gmail.com> 2013-09-09 10:32:08 PDT --- Got fixed somehwere along the way. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 09 2013