[Issue 24556] New: Allow IFTI for dotted template parameters used as function type parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 20 08:14:30 UTC 2024


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

          Issue ID: 24556
           Summary: Allow IFTI for dotted template parameters used as
                    function type parameter
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

Minor enhancement, not very useful but maybe that this should work:

```d
version(all) 
    void v(T,U)(T.U tu){}
else 
   void v(U, T = __traits(parent, U))(U tu){}; // that works fine RN

void main()
{
    struct S1 { S2 s2; struct S2 {} }
    S1 s1;
    v(s1.s2);

    struct G1 { struct G2 {} }
    G1.G2 g1g2;
    v(g1g2);
} 
```

That is currently rejected but the compiler could guess that `U` is either `S2`
or `G2` and then infer `T` as being the parent type (if any). That would be
similar to the case where D deduces T, let's say in `void v(T)(T[] t)`.

--


More information about the Digitalmars-d-bugs mailing list