[Issue 13990] New: std.algorithm.move incorrectly uses hasAliasing for class references

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jan 16 11:51:49 PST 2015


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

          Issue ID: 13990
           Summary: std.algorithm.move incorrectly uses hasAliasing for
                    class references
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: schveiguy at yahoo.com
          Reporter: schveiguy at yahoo.com

If we have an opaque class, we can't move the reference with
std.algorithm.move:

import std.algorithm.move

class S;

void main()
{
   S s;
   S s2;
   std.algorithm.move(s, s2); // Error, size of S unknown.
}

However, all move has to do is assignment in this case.

The issue is that we have a static if that checks hasAliasing on the class type
to do a check for internal pointers, but that is only relevant for structs. It
should be moved inside the check to see if it's a struct.

Doing pull request now.

--


More information about the Digitalmars-d-bugs mailing list