[Issue 9022] New: IFTI should support enclosing type/scope deduction

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 13 18:33:32 PST 2012


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: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 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: -------


More information about the Digitalmars-d-bugs mailing list