Steven Schveighoffer wrote: > On Mon, 04 May 2009 09:46:57 -0400, Qian Xu <quian...@stud.tu-ilmenau.de> > wrote: > >> Hi All, >> >> The following code will throw an exception: >> char[] s; >> assert( s.dup is null); // OK >> assert("".dup !is null); // FAILED >> >> "".dup is expectly also an empty string. >> Is this a compiler bug? >> > > I think you might have a bug? > > "".dup is the same as s.dup, not sure why you would expect it to be > not-null. > > -Steve
They are not the same. s is null. "" is an empty string. empty string and null are definitely two thing.