http://d.puremagic.com/issues/show_bug.cgi?id=9022

           Summary: IFTI should support enclosing type/scope deduction
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Kenji Hara <[email protected]> 2012-11-13 18:33:31 PST ---
This code doesn't work, but I think it should do.
---
class C
{
  struct X {}
}
void foo(T)(T, T.X)
{
    static assert(is(T == C));
}
void main()
{
    auto c = new C();
    auto cx = C.X();
    foo(c, cx);
}
---

In bug 9004, similar case has been introduced, but this enhancement does not
support that.
---
// From bug 9004 description:
struct Foo(_T) {
    alias _T T;
}
void bar(FooT)(FooT foo, FooT.T x) {
}
void main() {
    Foo!int foo;
    bar(foo, 1); // line 8 --> should fail
}
---

At line 8, the deduction from int to FooT.X should fail, because int type has
no enclosing scope.
(If FooT is already deduced, then it may seem to be able. However, it will
introduce an IFTI order dependency between function parameters. So it is an
another enhancement, and I don't propose it here.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to