[Issue 17623] New: Unexpected failure of an assertion on empty strings

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 8 10:10:56 PDT 2017


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 at puremagic.com
          Reporter: kdevel at 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 at stringidentity.d(5): Assertion failure

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

--


More information about the Digitalmars-d-bugs mailing list