www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19761] New: cannot .mangleof or typeof() a private member.

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

          Issue ID: 19761
           Summary: cannot .mangleof or typeof() a private member.
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: iamthewilsonator hotmail.com

struct Foo
{
    import core.thread;
            pragma(mangle, Thread._locks.mangleof) extern __gshared static
                typeof(Thread._locks) _locks;
}

onlineapp.d(4): Deprecation: `core.thread.Thread._locks` is not visible from
module `onlineapp`
onlineapp.d(4): Error: class `core.thread.Thread` member `_locks` is not
accessible
onlineapp.d(5): Deprecation: `core.thread.Thread._locks` is not visible from
module `onlineapp`
onlineapp.d(5): Error: class `core.thread.Thread` member `_locks` is not
accessible

the bogus is not visible can be worked around with 

struct Foo
{
    import core.thread;
        pragma(mangle, __traits(getMember, Thread, "_locks").mangleof) extern
__gshared static
            typeof(__traits(getMember, Thread, "_locks")) _locks;
}

but that still gives

onlineapp.d(4): Error: class `core.thread.Thread` member `_locks` is not
accessible
onlineapp.d(5): Error: class `core.thread.Thread` member `_locks` is not
accessible

--
Mar 24 2019