digitalmars.D.bugs - [Issue 8686] New: Tuple cannot define with type that has only mutable opEquals
- d-bugmail puremagic.com (41/41) Sep 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8686
- d-bugmail puremagic.com (10/10) Sep 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8686
- d-bugmail puremagic.com (15/15) Sep 18 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8686
- d-bugmail puremagic.com (9/9) Sep 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8686
http://d.puremagic.com/issues/show_bug.cgi?id=8686
Summary: Tuple cannot define with type that has only mutable
opEquals
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: regression
Priority: P2
Component: Phobos
AssignedTo: nobody puremagic.com
ReportedBy: zan77137 nifty.com
On git head, this code doesn't work:
-------------------------
import std.typecons;
struct S
{
bool opEquals(T)(T a) { return false; }
}
void main(string[] args)
{
auto t = tuple(S.init);
}
-------------------------
RESULT:
-------------------------
import\std\typecons.d(432): Error: template main.S.opEquals does not match any
function template declaration
main.d(5): Error: template main.S.opEquals cannot deduce template function from
argument types !()(const(S))
-------------------------
This problem is probably caused by this commit:
https://github.com/D-Programming-Language/phobos/commit/3c878f4b90670b46854fc66a09a8f68995fdb4ea
This implementation forces opEquals() const on the type that it controls.
Add a further condition that is to define the method if needed to constraint-if
to avoid it.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8686
Kenji Hara <k.hara.pg gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |pull, rejects-valid
https://github.com/D-Programming-Language/phobos/pull/803
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8686 Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/414ca6ffd211940d55d598e8a751090fb362da4c fix Issue 8686 - Tuple cannot define with type that has only mutable opEquals We cannot show better error message for mismatching tuple lengths, because compiler would *always* try to instantiate const opEquals. I also added tests for exhaustive opEquals signatures - const or mutable, and template or not https://github.com/D-Programming-Language/phobos/commit/7f5d95adf106a2a3cc1a8439b20cdafa5a8688f3 Issue 8686 and others, Tuple.opEquals and opCmp does not work in some cases -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 18 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8686
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: -------
Sep 22 2012









d-bugmail puremagic.com 