Bug 15039 – Algebraic cannot store a Typedef along with Typedef'ed type

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-09-11T13:54:00Z
Last change time
2015-10-28T10:31:01Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
kolos80

Comments

Comment #0 by kolos80 — 2015-09-11T13:54:54Z
Reproducible with dmd v2.068.1 Test case: // -------------------- import std.variant; import std.typecons; alias IntTypedef = Typedef!int; alias Obj = Algebraic!(int, IntTypedef, This[]); void x(Obj obj) { obj.visit!( (int x) => {}, (IntTypedef x) => {}, (Obj[] x) => {}, ); } void main(){} // -------------------- Produces the following error: /usr/include/dmd/phobos/std/variant.d(2266,21): Error: static assert "overload for type 'This[]' hasn't been specified" /usr/include/dmd/phobos/std/variant.d(2010,54): instantiated from here: visitImpl!(true, VariantN!(16LU, int, Typedef!(int, 0, null), This[]), function (int x) => () { } , function (Typedef!(int, 0, null) x) => () { } , function (VariantN!(16LU, int, Typedef!(int, 0, null), This[])[] x) => () { } ) src/app.d(9,8): instantiated from here: visit!(VariantN!(16LU, int, Typedef!(int, 0, null), This[])) dmd failed with exit code 1. However the following code (just without Typedef) compiles just fine: // -------------------- import std.variant; import std.typecons; alias IntTypedef = Typedef!int; alias Obj = Algebraic!(int, This[]); void x(Obj obj) { obj.visit!( (int x) => {}, (Obj[] x) => {}, ); } void main(){} // -------------------- You can even have Algebraic!(int, int, This[]) without any problems.
Comment #1 by dlang-bugzilla — 2015-09-28T08:52:07Z
This seems to be a regression. Introduced in https://github.com/D-Programming-Language/phobos/pull/3394
Comment #2 by k.hara.pg — 2015-10-22T02:53:11Z
Comment #3 by github-bugzilla — 2015-10-22T12:01:58Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/1df5afebe4274ef2ab382076d569b91835f832c4 fix Issue 15039 - Algebraic cannot store a Typedef along with Typedef'ed type https://github.com/D-Programming-Language/phobos/commit/c0510fc7ea8f4fb5dc100df4f7d01b3d8f974259 Merge pull request #3761 from 9rnsr/fix15039 Issue 15039 - Algebraic cannot store a Typedef along with Typedef'ed type
Comment #4 by dlang-bugzilla — 2015-10-27T15:13:52Z
*** Issue 15168 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2015-10-28T10:31:01Z