Bug 10343 – Cannot resolve a forward reference to a template inside global typeof
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-12T07:18:00Z
Last change time
2013-07-06T04:46:37Z
Assigned to
nobody
Creator
ttanjo
Comments
Comment #0 by ttanjo — 2013-06-12T07:18:51Z
This code does not compile on the following environment:
* DMD 64 v2.064-devel-e654595 on Linux 64bit
* DMD 64 v2.063 on Linux 64bit
* DMD 32 v2.063 on Windows 7 32bit
---- error.d starts -----
// If uncomment next line, this code can compile.
// typeof(foo!int(3)) y;
typeof(foo(1)) x;
auto foo(T)(T t) { return t; }
void main() {
}
---- error.d ends ------
I got the following messages:
$ dmd error.d
error.d(4): Error: template error.foo(T)(T t) forward reference to template foo(T)(T t)
error.d(3): Error: template error.foo(T)(T t) cannot deduce template function from argument types !()(int)
Comment #1 by ttanjo — 2013-07-06T04:46:37Z
I found it can be compiled without errors in trunk (v2.064-devel-fbbdba5).
Thanks!