Bug 19697 – ReplaceType fails to compile for self-referential inheritance chains
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-02-23T15:51:29Z
Last change time
2019-08-02T02:47:24Z
Keywords
pull
Assigned to
No Owner
Creator
Sönke Ludwig
Comments
Comment #0 by sludwig — 2019-02-23T15:51:29Z
Test case:
---
import std.typecons : ReplaceType;
class C : D!C {}
class D(T) {}
static assert(is(ReplaceType!(float, float, C)));
---
Generated error if instantiated outside of "is":
> /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(8658): Error: template instance `U!(__T11ReplaceTypeTfTfTC9onlineapp1CZ)` does not match template declaration D(T)
> onlineapp.d(4): Error: template instance `std.typecons.ReplaceType!(float, float, C)` error instantiating
Comment #1 by dlang-bot — 2019-07-31T23:41:03Z
@pbackus created dlang/phobos pull request #7121 "Fix issues 19696, 19697, 16132 - ReplaceType bugs" fixing this issue:
- Fix issues 19696, 19697, 16132 - ReplaceType bugs
ReplaceType no longer gives incorrect results for types that can be
implicitly converted to a templated type, either via inheritance (19697,
16132) or alias this (19696).
https://github.com/dlang/phobos/pull/7121
Comment #2 by dlang-bot — 2019-08-02T02:47:24Z
dlang/phobos pull request #7121 "Fix issues 19696, 19697, 16132 - ReplaceType bugs" was merged into stable:
- e7d6e9ff508fee42eea9986c0fb59bd3546b862f by Paul Backus:
Fix issues 19696, 19697, 16132 - ReplaceType bugs
ReplaceType no longer gives incorrect results for types that can be
implicitly converted to a templated type, either via inheritance (19697,
16132) or alias this (19696).
https://github.com/dlang/phobos/pull/7121