[Issue 23964] [REG2.102] inccorect error opAssign cannot be used ... @disable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 19 15:50:01 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
The problem stems from the fact that `asdasdasd` is a system variable because
it calls `foo` which is system. When the compiler tries to generate opAssign
for ClusterInfoJohan it looks at the attributes of the potential
opAssign/postblits/destructors it might call to deduce the attributes of the
generated opAssign. Since UUID.opAssign is nogc and safe and the rest of the
assignments (for oiuoi and asdasdasd) do not call any other user defined
operators, the compiler wrongfully thinks that the generated opAssign should be
nogc and safe. However, since we are accessing a system variable, it will issue
a deprecation (which is silent normally, because errors are gagged when
analyzing generated functions) which is catched when compiled with -de.

A workaround is to make `foo` @safe. That will make the code to compile.

Patch incoming.

--


More information about the Digitalmars-d-bugs mailing list