Linker error

Anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 5 11:30:25 PDT 2016


Why does the following give a linker error?

If I change static Note[0] empty; to static Note[] empty;, all is 
well.
Or if I leave it as Note[0] empty; and don't use it in getNotes, 
all is well.

struct Note
{
	string topic;
	string content;
}

class NoteStore
{	
	
	Note[][string] store;
	
	static Note[0] empty;
	
	Note[] getNotes(string id)
	{
		return (id in store) ? store[id] : empty;
	}	
}

void main() {}

dmd --version
DMD32 D Compiler v2.070.0
Windows 10


More information about the Digitalmars-d-learn mailing list