Linker error

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


On Sunday, 5 June 2016 at 18:30:25 UTC, Anonymous wrote:
> 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

Should have included:

OPTLINK (R) for Win32  Release 8.00.17
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
ns.obj(ns)  Offset 0BA0AH Record Type 009D
  Error 16: Index Range
--- errorlevel 1


More information about the Digitalmars-d-learn mailing list