Bug 1514 – mixin doesn't make the template to "function template"

Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-09-18T00:56:42Z
Last change time
2023-03-27T12:07:36Z
Assigned to
No Owner
Creator
david

Comments

Comment #0 by davidl — 2007-09-18T00:56:42Z
import std.stdio; template prerequisite(T) { static assert(T.max==int.max); alias T type; } template mytemp(T) { mixin subtemp!(T); template subtemp(U:prerequisite!(T).type) { void mytemp(T v) { writefln(v); } } } void main() { mytemp(3); }
Comment #1 by davidl — 2007-09-18T01:00:42Z
simplified case abc.d: import std.stdio; template mytemp(T) { mixin subtemp!(T); template subtemp(U) { void mytemp(T v) { writefln(v); } } } void main() { mytemp(3); } abc.d(3): template abc.mytemp(T) is not a function template abc.d(17): template abc.mytemp(T) cannot deduce template function from argument types (int)
Comment #2 by razvan.nitu1305 — 2019-08-21T11:01:27Z
This bug report is invalid. mytemp is not an eponymous template because it has a single member that is the mixin. So when the call occurs the compiler first needs to identify what you are trying to call, thus it finds the mytemp template, but inside it there is no function, there's only a mixin => confusion for the compiler. This cannot be fixed, because you would have to instantiate the mixin before actually instantiating the template. Closing as invalid.
Comment #3 by razvan.nitu1305 — 2023-03-27T12:07:36Z
*** Issue 11095 has been marked as a duplicate of this issue. ***