Bug 22111 – Can't deduce template argument for non-eponymous templated type

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-07T19:44:59Z
Last change time
2024-12-13T19:17:33Z
Assigned to
No Owner
Creator
Paul Backus
Moved to GitHub: dmd#18045 →

Comments

Comment #0 by snarwin+bugzilla — 2021-07-07T19:44:59Z
As of DMD 2.097.0, the following program fails to compile: --- template Outer(T) { struct Inner {} } void func(T)(Outer!T.Inner) {} void main() { Outer!int.Inner arg; func(arg); // error; } --- The error message is: --- onlineapp.d(11): Error: template `onlineapp.func` cannot deduce function from argument types `!()(Inner)`, candidates are: onlineapp.d(6): `func(T)(Outer!T.Inner)` --- If the call to `func` is changed to `func!int(arg)`, compilation succeeds. Pattern-matching of types in `is()` expressions is also affected by this issue: --- static assert(is(typeof(arg) == Outer!int.Inner)); // pass static assert(is(typeof(arg) == Outer!T.Inner, T)); // fail ---
Comment #1 by robert.schadek — 2024-12-13T19:17:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18045 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB