www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23095] New: taggedPointer accessors are not scope

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

          Issue ID: 23095
           Summary: taggedPointer accessors are not scope
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: baiocchi.gabriel grad.ufsc.br

taggedPointer generates  property accessors for every separate part of the
tagged pointer. However, these don't work on a scope reference when compiling
with -dip1000:

import std.bitmanip : taggedPointer;

struct S {
    mixin(taggedPointer!(
        int*, "ptr",
        bool, "flag", 1
    ));
}

void foo(scope ref S s)  safe
{
    s.flag; // <- error points here
}

// Error: scope variable `s` assigned to non-scope parameter `this` calling
test.S.flag

--
May 05 2022