[Issue 19667] .offsetof cannot be used on non-public members of aggregates in different modules
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 18 23:23:58 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19667
Sprink <sprink.noreply at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sprink.noreply at gmail.com
--- Comment #1 from Sprink <sprink.noreply at gmail.com> ---
tupleof is effective a member function of S that has access to those private
fields. The returned type is a new tuple, not of type S so none of the fields
are private. If you want to know the offset of you can do the same thing.
struct S {
public int publicField;
private int privateField;
public auto tupleof() {
return Tuple!("publicField", publicField, "privateField", privateField);
}
public auto privateFieldOffsetOf() { return privateField.offsetof; }
}
--
More information about the Digitalmars-d-bugs
mailing list