[Issue 15794] New: Lambda mangled differently after being passed as template argument
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sun Mar 13 11:33:46 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=15794
          Issue ID: 15794
           Summary: Lambda mangled differently after being passed as
                    template argument
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com
The following program fails to link because the lambda on line 26 is mangled
differently in functions fun and gun:
struct Foo {
    static void fun(Holder)() {
        pragma(msg, "Mangled name in fun:");
        pragma(msg, Holder.fn.mangleof);
        pragma(msg, "");
        int i = Holder.fn();
    }
}
struct Holder(alias Fn) {
    alias fn = Fn;
}
void gun(alias fn, U...)() {
    Foo.fun!(Holder!fn)();
    pragma(msg, "Mangled name in gun:");
    pragma(msg, fn.mangleof);
    pragma(msg, "");
    static if (U.length > 0) {
        return gun!U;
    }
}
unittest {
    gun!(() => 0)(); // Line 26
}
--
    
    
More information about the Digitalmars-d-bugs
mailing list