Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 26, 2019 [Issue 19703] std.typecons.ReplaceType wrongly evaluates alias this | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19703 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |simen.kjaras@gmail.com Summary|Algebraic doesn't work with |std.typecons.ReplaceType |alias this of templated |wrongly evaluates alias |type |this --- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> --- Reduced example: import std.typecons : ReplaceType; struct S1(int n) { } struct S2 { S1!4 s1; alias s1 this; } static assert(is(ReplaceType!(int, int, S2)[0] == S2)); The problem is this line in std.typecons: https://github.com/dlang/phobos/blob/13705f53bd3322168de5701d64a5f7c8cf791867/std/typecons.d#L8682 It aggressively matches alias this where it shouldn't. It should check if T[0]'s alias this is what's being matched instead of T[0] itself. Here's one possible fix: private template isAliasThis(T, alias U, V...) { static foreach (at; __traits(getAliasThis, T)) { static if (is(typeof(__traits(getMember, T, at)) : U!V)) { enum isAliasThis = true; } } static if (!__traits(compiles, assert(isAliasThis))) { enum isAliasThis = false; } } And replacing the offending line with this: else static if (is(T[0] : U!V, alias U, V...) && !isAliasThis!(T, U, V)) -- |
February 27, 2019 [Issue 19703] std.typecons.ReplaceType wrongly evaluates alias this | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19703 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> --- @Biotronic created dlang/phobos pull request #6880 "Fix issue 19703 - std.typecons.ReplaceType wrongly evaluates alias this" fixing this issue: - Fix issue 19703 https://github.com/dlang/phobos/pull/6880 -- |
March 05, 2019 [Issue 19703] std.typecons.ReplaceType wrongly evaluates alias this | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19703 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com Component|dmd |phobos -- |
July 31, 2019 [Issue 19703] std.typecons.ReplaceType wrongly evaluates alias this | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19703 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |snarwin+bugzilla@gmail.com Resolution|--- |DUPLICATE --- Comment #3 from Paul Backus <snarwin+bugzilla@gmail.com> --- *** This issue has been marked as a duplicate of issue 19696 *** -- |
Copyright © 1999-2021 by the D Language Foundation