Bug 24556 – Allow IFTI for dotted template parameters used as function type parameter

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-05-20T08:14:30Z
Last change time
2024-05-30T01:27:34Z
Assigned to
No Owner
Creator
basile-z

Comments

Comment #0 by b2.temp — 2024-05-20T08:14:30Z
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)`.
Comment #1 by b2.temp — 2024-05-30T01:27:34Z
Bad idea.