Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
August 08, 2012 [Issue 8522] New: Overloading template function with prefix const doesn't work | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=8522 Summary: Overloading template function with prefix const doesn't work Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-08-08 08:17:28 PDT --- Postfix const works, but prefix version doesn't work struct Tuple(Specs...) { Specs field; bool opEquals(R)(R rhs) { return true; } // bool opEquals(R)(R rhs) const { return true; } // OK const bool opEquals(R)(R rhs) { return true; } // NG } void main() { Tuple!(size_t, size_t) t; assert(t == t); // line 14 } output: test.d(14): Error: template test.Tuple!(uint,uint).Tuple.opEquals matches more than one template declaration, test.d(5):opEquals(R) and test.d(8):opEquals(R) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 08, 2012 [Issue 8522] Overloading template function with prefix const doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8522 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-08-08 08:51:16 PDT --- More explainable test case. struct Point { bool opEquals(R)(R rhs) { return true; } bool opEquals(R)(R rhs) const { return true; } } void main() { Point mp; const Point cp; assert(mp == mp); assert(mp == cp); assert(cp == mp); // doesn't work assert(cp == cp); // doesn't work } If the left hand side of '==' is const value, const opEquals never matches. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 08, 2012 [Issue 8522] Comparison operator overloading doesn't consider the qualifier of lhs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8522 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Summary|Overloading template |Comparison operator |function with prefix const |overloading doesn't |doesn't work |consider the qualifier of | |lhs --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2012-08-08 08:58:02 PDT --- https://github.com/D-Programming-Language/dmd/pull/1075 And changed the title. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 23, 2012 [Issue 8522] Comparison operator overloading doesn't consider the qualifier of lhs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8522 --- Comment #3 from github-bugzilla@puremagic.com 2012-08-23 08:25:59 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f6af3ce56851c2b120a87cabc79b4c3427f04606 fix Issue 8522 - Comparison operator overloading doesn't consider the qualifier of lhs https://github.com/D-Programming-Language/dmd/commit/7cc1b80964cb8c45e4136a71860f05853d89931d Merge pull request #1075 from 9rnsr/fix8522 Issue 8522 - Comparison operator overloading doesn't consider the qualifier of lhs -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 15, 2012 [Issue 8522] Comparison operator overloading doesn't consider the qualifier of lhs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=8522 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation