[Issue 20414] New: use of isCopyable on static members of uncopyable struct returns that its copyable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 22 20:51:28 UTC 2019


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

--


More information about the Digitalmars-d-bugs mailing list