www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23035] New: -preview=rvaluerefparam causes system function

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

          Issue ID: 23035
           Summary: -preview=rvaluerefparam causes  system function to be
                     safe
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

Related to https://issues.dlang.org/show_bug.cgi?id=20869, which added this
test to druntime:

-------------
 system unittest
{
    static struct S
    {
        void opPostMove(const ref S old) nothrow  system
        {
            __gshared int i;
            new int(i++); // Force  gc impure  system
        }
    }

    alias T = void function()  system nothrow;
    static assert(is(typeof({ S s; move(s); }) == T));
    static assert(is(typeof({ S s; move(s, s); }) == T));
}
------------

If druntime tests are compiled with -preview=rvalueparam, the first static
assert fails, since now that function is considered  safe for some reason.

--
Apr 18 2022