Bug 10257 – .tupleof loses protection information upon iteration

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-03T12:44:00Z
Last change time
2016-08-27T23:34:52Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2013-06-03T12:44:04Z
----- void main() { struct S { private int x; } S store; foreach (idx, val; store.tupleof) { pragma(msg, "direct: " ~ __traits(getProtection, store.tupleof[idx])); pragma(msg, "indirect: " ~ __traits(getProtection, val)); } } ----- Writes: > direct: private > indirect: public I'm not sure how hard it will be to fix this, or if it's possible at all.
Comment #1 by andrej.mitrovich — 2016-08-27T23:34:52Z
Not really a bug per say, it's calling getProtection on a value in a tuple, it's bound to be public. The issue of whether it should have access to private symbols or not is part of https://issues.dlang.org/show_bug.cgi?id=1223.