Thread overview | |||||
---|---|---|---|---|---|
|
February 18, 2019 [Issue 19667] .offsetof cannot be used on non-public members of aggregates in different modules | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19667 Sprink <sprink.noreply@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sprink.noreply@gmail.com --- Comment #1 from Sprink <sprink.noreply@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; } } -- |
December 17, 2022 [Issue 19667] .offsetof cannot be used on non-public members of aggregates in different modules | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19667 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
July 27, 2023 [Issue 19667] .offsetof cannot be used on non-public members of aggregates in different modules | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19667 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |dkorpel@live.nl Resolution|--- |INVALID --- Comment #2 from Dennis <dkorpel@live.nl> --- Access checks can be circumvented with __traits(getMember) and tupleof for meta-programming purposes. `S.privateField` fails the access check before `.offsetof` is queried on that. Making `.offsetof` undo the access check of its operand is more hacky than using existing methods. -- |
Copyright © 1999-2021 by the D Language Foundation