www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20414] New: use of isCopyable on static members of uncopyable

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

          Issue ID: 20414
           Summary: use of isCopyable on static members of uncopyable
                    struct returns that its copyable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

e.g.:
import std.traits;

struct X
{
    disable this(this); // make uncopyable
   pragma(msg, isCopyable!X); // true!
}

pragma(msg, isCopyable!X); // true unless pragma above is commented out

Inspecting whether a struct is copyable inside the struct seems to return that
it is, even when it should be disabled. If you remove the inspection inside,
then the outer instantiation becomes false.

The use case I have is declaring a static member that works with instances of
the struct inside the struct itself.

I initially was thinking this was a Phobos bug, but I think it's an issue with
the compiler.

--
Nov 22 2019