[Issue 19849] New: undefined identifier using identity specialization in specific circumstance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 6 14:33:45 UTC 2019


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

          Issue ID: 19849
           Summary: undefined identifier using identity specialization in
                    specific circumstance
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: destructionator at gmail.com

---
struct Foo {
   @disable this(U : U)(U i);
   this(U : uint)(U u) { }
}

void main() {
        Foo foo = 0u;
}
---

bug.d(2): Error: undefined identifier U

Which I'm pretty sure shouldn't happen, since the identity specialization works
in other cases, but since the other cases are with constraints so maybe not...

---
struct Foo {
   @disable this(U)(U i);
   this(U : U)(U u) if(is(U == uint)) { }
}

void main() {
        Foo foo = 0u;
        Foo foo2 = 0;
}
---

That works as I want, so the U:U pattern sometimes works.

--


More information about the Digitalmars-d-bugs mailing list