[Issue 9571] link error due to using unique ids in anonymous funcliteral

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 17 01:26:13 PDT 2013


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



--- Comment #11 from Kenji Hara <k.hara.pg at gmail.com> 2013-09-17 01:26:10 PDT ---
(In reply to comment #10)
> The root cause of this issues got hidden / fixed by
> https://github.com/D-Programming-Language/dmd/pull/2550 (as only one template
> instance is emitted and thus only one literal ID gets generated).
> 
> I can't imagine any other way to manifest this issue (without using template
> instances) but it may be theoretically possible.

Able to cause the issue by combining -inline.

//a.d
import b;
void main()
{
    foo();
}

// b.d
struct MapResult(alias fun)
{
    void bar() { fun(0); }
}
auto foo()
{
    alias MapResult!(function(int c) => 0) M;
    M m;
    m.bar();
}

Command:
$ dmd -inline -c a.d
$ dmd -inline -c b.d
$ dmd -oftest.exe a.obj b.obj
OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
a.obj(a)
 Error 42: Symbol Undefined
_D1b51__T9MapResultS34_D1b3foo14__funcliteral4FNaNbNfiZiZ9MapResult3barMFNaNbNfZv
--- errorlevel 1

-- 
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