www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - literals vs. multiple definition. fight.

I've posted this some time ago but I wasn't understood :`(

This code should work: $CODE but instead the linker prefers to claim that the
literal had multiple definitions.

Solutions:
1. Kill the linker <- user
2. Add a name to the function <- user
3. Correct function literal name mangling <- Walter

Let me quote Shrek... "Pick 3 my lord, number 3!"

export CODE = '''
import std.stdio;

void foo()
{
void function() fp = null;

fp = function void() { writefln("func1"); };
fp();

fp = function void() { writefln("func2"); };
fp();
}

void main()
{
foo();
}
'''

cyaz,
Tom
Jul 09 2004