www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - bug of function literals

Hello.

Two nameless function literals which has same signature in one function 
will have same identifier for linker.
It causes a linker error.

(dmd 0.98 and 0.99)

YT

====================================
void test()
{
	int function (int i) x = function int (int i) { return i * 2; };
	int function (int i) y = function int (int i) { return i / 2; };
}

int main()
{
	test();
	return 0;
}
==================================================
D:\Programming\tests\D>dmd a
C:\Program Files\DM\dmd\bin\..\..\dm\bin\link.exe a,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

a.obj(a)  Offset 0015FH Record Type 00C3
  Error 1: Previous Definition Different : _D1a4test0FiZi
--- errorlevel 1
Aug 20 2004