← Back to index
|
Original Bugzilla link
Bug 10134 – Mutual referencing templates error
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-22T03:52:00Z
Last change time
2013-05-23T00:59:13Z
Keywords
pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2013-05-22T03:52:57Z
With git head, the following code reports these errors. test.d(22): Error: template instance Result!(__T13getResultTypeS124test6__T1aZZ) does not match template declaration Result(T) test.d(40): Error: template instance test.f!(__T1aZ) error instantiating test.d(32): instantiated from here: b!() test.d(44): instantiated from here: a!() test.d(32): Error: template instance test.b!() error instantiating test.d(44): instantiated from here: a!() test.d(44): Error: template instance test.getResultType!(__T1aZ) error instantiating test.d(44): while evaluating pragma(msg, getResultType!(__T1aZ)) But with 2.062, it compiles successfully and prints 'double'. //import std.traits : ReturnType; template ReturnType(alias func) { static if (is(typeof(func) R == return)) alias R ReturnType; else static assert(0); } struct Result(T){} template getResultType(alias func) { static if(is(ReturnType!(func.exec) == Result!(T), T)) { alias getResultType = T; } } template f(alias func) { Result!(getResultType!(func)) exec(int i) { return typeof(return)(); } } template a() { Result!(double) exec(int i) { return b!().exec(i); } } template b() { Result!(double) exec(int i) { return f!(a!()).exec(i); } } pragma(msg, getResultType!(a!())); void main(){}
Comment #1
by k.hara.pg — 2013-05-22T04:04:33Z
https://github.com/D-Programming-Language/dmd/pull/2062
Comment #2
by github-bugzilla — 2013-05-23T00:54:52Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/a60e757ba69e890881480b98a6dba5456832f55f
fix Issue 10134 - Mutual referencing templates error
https://github.com/D-Programming-Language/dmd/commit/9edb35f64c700eca65be718aa057cdc344896836
Merge pull request #2062 from 9rnsr/fix10134 [2.063a] Issue 10134 - Mutual referencing templates error
Comment #3
by github-bugzilla — 2013-05-23T00:56:52Z
Commit pushed to 2.063 at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/a0292c10efb67931e208e0736f626ad5ef3fe531
Merge pull request #2062 from 9rnsr/fix10134 [2.063a] Issue 10134 - Mutual referencing templates error