[Issue 2962] ICE(glue.c) or bad codegen passing variable as template value parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 8 05:25:09 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=2962


tmn <tmn.dbugs at mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tmn.dbugs at mailinator.com


--- Comment #43 from tmn <tmn.dbugs at mailinator.com> 2012-11-08 05:24:57 PST ---
Using a local variable inside the delegate instead of a parameter of the
calling function results in incorrect code:

----------------
module b;
auto call(alias fun)() {
    return fun(0);
}
----------------
module a;
import b;
import std.stdio;
void main() {
    int x = 1;
    writeln(call!(a => x));    // should print the value of x
}
----------------

$ dmd b.d a.d -ofa && ./a
-771364480


(Using DMD64 D Compiler v2.060 on Linux)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list