digitalmars.D.bugs - [Issue 20863] New: Pass into template by alias drops qualifier
- d-bugmail puremagic.com (37/37) May 25 2020 https://issues.dlang.org/show_bug.cgi?id=20863
https://issues.dlang.org/show_bug.cgi?id=20863 Issue ID: 20863 Summary: Pass into template by alias drops qualifier Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: andrei erdani.com Took me a while to make this 100% self-contained. Both asserts should pass. The second fails. alias AliasSeq(Seq...) = Seq; template staticIndexOf(alias T, TList...) { static if (TList.length == 0) { enum int staticIndexOf = -1; } else static if (is(T == TList[0])) { enum int staticIndexOf = 0; } else { private enum int t = staticIndexOf!(T, TList[1 .. $]); enum int staticIndexOf = t < 0 ? t : t + 1; } } struct Foo {} static assert(staticIndexOf!(Foo, AliasSeq!(Foo)) == 0); // pass static assert(staticIndexOf!(immutable(Foo), AliasSeq!(immutable(Foo))) == 0); // fail --
May 25 2020