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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 6 04:36:59 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18831

--- Comment #1 from | <dhasenan at gmail.com> ---
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)

--


More information about the Digitalmars-d-bugs mailing list