www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19696] New: ReplaceType replaces type with the type

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

          Issue ID: 19696
           Summary: ReplaceType replaces type with the type forwarding
                    using alias this
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: sludwig outerproduct.org

Test case:

---
import std.typecons : ReplaceType;

struct S {
    T!int t;
    alias t this;
}

struct T(U) {}

// fails with !is(T!int == S)
static assert(is(ReplaceType!(float, float, S) == S));
---

If T is instead a non-template type, the result is S, as expected.

--
Feb 23 2019