[Issue 18831] Weird interaction between std.variant, std.algorithm.iteration.map, and alias this

2020-06-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18831

Paul Backus  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||snarwin+bugzi...@gmail.com
 Resolution|--- |FIXED

--- Comment #2 from Paul Backus  ---
The given example compiles successfully as of DMD 2.092.1.

--


[Issue 18831] Weird interaction between std.variant, std.algorithm.iteration.map, and alias this

2018-05-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18831

--- Comment #1 from |  ---
Some notes on paring it down:

* Omitting the call to map makes this compile.
* Omitting the alias this makes it compile.
* You don't actually need a struct Bar; `map!(x => x)` is enough.
* You can use an array instead of iota.
* Replacing the lambda parameter with a top-level function (map!identity)
changes the error to:
/home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7784): Error:
function algebraicaliasthis.identity(string s) is not callable using argument
types ()
/home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template
instance `std.typecons.ReplaceType!(This, VariantN!(1LU, Foo),
Foo).F!(identity)` error instantiating
/home/dhasenan/.local/bin/../include/phobos/std/meta.d(805):   
instantiated from here: staticMap!(replaceTemplateArgs, identity)
/home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788):   
instantiated from here: staticMap!(replaceTemplateArgs, identity, string[])
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(103):   
instantiated from here: ReplaceType!(This, VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(137):   
instantiated from here: This2Variant!(VariantN!(1LU, Foo), Foo)
/home/dhasenan/.local/bin/../include/phobos/std/variant.d(1500):   
instantiated from here: VariantN!(1LU, Foo)
algebraicaliasthis.d(16):instantiated from here: Algebraic!(Foo)

--