digitalmars.D.bugs - [Issue 18831] New: Weird interaction between std.variant,
- d-bugmail puremagic.com (52/52) May 05 2018 https://issues.dlang.org/show_bug.cgi?id=18831
https://issues.dlang.org/show_bug.cgi?id=18831 Issue ID: 18831 Summary: Weird interaction between std.variant, std.algorithm.iteration.map, and alias this Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: dhasenan gmail.com --- import std.variant, std.range, std.algorithm; struct Bar { int i; } struct Foo { auto i() { return iota(12) .map!(x => Bar(x)); } alias i this; } void main() { Foo controlGroup = Foo(); Algebraic!(Foo) treatmentGroup = Foo(); } --- The control group works without errors. The treatment group fails with: /home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template instance `F!(__lambda1)` cannot use local __lambda1 as parameter to non-global template replaceTemplateArgs(T...) /home/dhasenan/.local/bin/../include/phobos/std/meta.d(805): Error: template instance `algebraicaliasthis.Foo.i.staticMap!(replaceTemplateArgs, __lambda1)` error instantiating /home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788): instantiated from here: staticMap!(replaceTemplateArgs, __lambda1, Result) /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(20): instantiated from here: Algebraic!(Foo) --
May 05 2018