[Issue 23035] New: -preview=rvaluerefparam causes @system function to be @safe

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 18 12:46:05 UTC 2022


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

--


More information about the Digitalmars-d-bugs mailing list