Bug 20414 – use of isCopyable on static members of uncopyable struct returns that its copyable

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-11-22T20:51:28Z
Last change time
2024-12-13T19:06:17Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Steven Schveighoffer
Moved to GitHub: dmd#19643 →

Comments

Comment #0 by schveiguy — 2019-11-22T20:51:28Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:06:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19643 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB