[Issue 7942] New: Appending a string to a dstring is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 19 03:44:30 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7942

           Summary: Appending a string to a dstring is allowed
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: james at aatch.net


--- Comment #0 from James Miller <james at aatch.net> 2012-04-19 03:45:23 PDT ---
Appending a regular `string` to a `dstring` does not cause a compile time
error.

This case:

  string a = "abc";
  dstring b = "abc"d;

  b ~= a;

Causes a runtime error: array cast misalignment.

This case:

  string a = "abcd";
  dstring b = "abcd"d;

  b ~= a;
  writeln(b);

causes a segmentation fault. Given that

  string a = "abcd";
  dstring b = "abcd"d;

  a ~= b;

causes a compile time error, and many other operations do not allow implicit
string -> dstring casting, it should be picked up as a type error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list