www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13990] New: std.algorithm.move incorrectly uses hasAliasing


          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 yahoo.com
          Reporter: schveiguy yahoo.com

If we have an opaque class, we can't move the reference with

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.

Jan 16 2015