www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7942] New: Appending a string to a dstring is allowed

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 puremagic.com
        ReportedBy: james aatch.net



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: -------
Apr 19 2012