Bug 14890 – [REG 2.068.0-rc1] Can not construct a RedBlackTree of Tuples

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-09T16:15:00Z
Last change time
2017-07-19T17:43:42Z
Keywords
pull, rejects-valid
Assigned to
code
Creator
gassa

Comments

Comment #0 by gassa — 2015-08-09T16:15:09Z
Code: ----- void main () { import std.container, std.typecons; alias Vertex = Tuple !(int, q{t}, int, q{v}); auto cur = redBlackTree !(Vertex) (); } ----- Works in 2.067.1 but fails to compile with 2.068: beta 1, beta 2 and release candidate 1. The error is: ----- ...\src\phobos\std\functional.d-mixin-213(213): Error: template std.typecons.Tuple!(int, "t", int, "v").Tuple.opCmp cannot deduce function from argument types !()(inout(Tuple!(int, "t", int, "v"))), candidates are: ...\src\phobos\std\typecons.d(644): std.typecons.Tuple!(int, "t", int, "v").Tuple.opCmp(R)(R rhs) if (areCompatibleTuples!(typeof(this), R, "<")) ...\src\phobos\std\typecons.d(658): std.typecons.Tuple!(int, "t", int, "v").Tuple.opCmp(R)(R rhs) if (areCompatibleTuples!(typeof(this), R, "<")) ...\src\phobos\std\container\rbtree.d(825): Error: template instance std.functional.binaryFun!("a < b", "a", "b").binaryFun!(Tuple!(int, "t", int, "v"), inout(Tuple!(int, "t", int, "v"))) error instantiating ...\src\phobos\std\container\rbtree.d(1729): instantiated from here: RedBlackTree!(Tuple!(int, "t", int, "v"), "a < b", false) test_rbtree.d(4): instantiated from here: redBlackTree!(Tuple!(int, "t", int, "v")) ----- Note the two identical candidates for opCmp listed as typecons.d(644) and typecons.d(658). I can build a redBlackTree !(int), or compare two of my Tuples, just fine. It is their combination that does not work.
Comment #1 by code — 2015-08-10T01:48:45Z
Comment #2 by k.hara.pg — 2015-08-10T02:56:03Z
https://github.com/D-Programming-Language/phobos/pull/3538(In reply to Martin Nowak from comment #1) > The problem is that areCompatibleTuples > (https://github.com/D-Programming-Language/phobos/blob/ > 94f718e5c69939f595fb839d3aae24878f126d78/std/typecons.d#L396) can't handle > an inout Tup2 b/c it declares a local variable. https://github.com/D-Programming-Language/phobos/pull/3538
Comment #3 by github-bugzilla — 2015-08-10T06:33:15Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/eff54e62ca7203f02360d71fc646e57d3bccf8d5 fix Issue 14890 - Can not construct a RedBlackTree of Tuples https://github.com/D-Programming-Language/phobos/commit/b82986e64fbb2950af118f4711e1558a4134c803 Merge pull request #3538 from 9rnsr/fix14890 [REG 2.068.0-rc1] Issue 14890 - Can not construct a RedBlackTree of Tuples
Comment #4 by github-bugzilla — 2015-08-10T09:48:07Z
Comment #5 by github-bugzilla — 2017-07-19T17:43:42Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/eff54e62ca7203f02360d71fc646e57d3bccf8d5 fix Issue 14890 - Can not construct a RedBlackTree of Tuples https://github.com/dlang/phobos/commit/b82986e64fbb2950af118f4711e1558a4134c803 Merge pull request #3538 from 9rnsr/fix14890