www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17623] New: Unexpected failure of an assertion on empty strings

https://issues.dlang.org/show_bug.cgi?id=17623

          Issue ID: 17623
           Summary: Unexpected failure of an assertion on empty strings
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kdevel vogtner.de

According to the documentation [1]:

   "For static and dynamic arrays, identity is defined as referring to
    the same array elements and the same number of elements."

this code

   $ cat stringidentity.d 
   void main ()
   {
      string s = null;
      string t = "";
      assert (s is t);
   }

shall pass but the assertion fails

   $ ./stringidentity
   core.exception.AssertError stringidentity.d(5): Assertion failure

[1] https://dlang.org/spec/expression.html#identity_expressions

--
Jul 08