Bug 16369 – [REG 2.071] getSymbolsByUDA fails if type inherits private members

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-08-10T13:04:42Z
Last change time
2018-03-23T09:42:52Z
Keywords
industry
Assigned to
No Owner
Creator
Johan Engelen

Comments

Comment #0 by jbc.engelen — 2016-08-10T13:04:42Z
File m.d: ``` class M { private // comment out to "fix" the problem int mmm; } ``` File a.d: ``` import m; enum U; class A : M { @U int aaa; } void main() { import std.traits; alias E = getSymbolsByUDA!(A, U); } ``` Command `dmd -c a.d` works with DMD 2.070.2, but fails with DMD 2.071.2-b2. Error: ❯ dmd -c a.d std/traits.d-mixin-6733(6733): Deprecation: m.M.mmm is not visible from class A std/traits.d-mixin-6733(6733): Deprecation: m.M.mmm is not visible from module traits std/traits.d-mixin-6733(6733): Error: class a.A member mmm is not accessible std/meta.d(770): Error: template instance std.traits.getSymbolsByUDA!(A, U).pred!"mmm" error instantiating std/meta.d(780): instantiated from here: Filter!(hasSpecificUDA, "mmm") std/meta.d(779): instantiated from here: Filter!(hasSpecificUDA, "aaa", "mmm") std/meta.d(779): instantiated from here: Filter!(hasSpecificUDA, "aaa", "mmm", "toString", "toHash") std/traits.d(6735): instantiated from here: Filter!(hasSpecificUDA, "aaa", "mmm", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory") a.d(13): instantiated from here: getSymbolsByUDA!(A, U) Related bug (but not the same): https://issues.dlang.org/show_bug.cgi?id=15335 Related Phobos commit: https://github.com/dlang/phobos/commit/79fd6aac7956179b300c43f3320347ce0c1fe46b (no PR?)
Comment #1 by dfj1esp02 — 2016-08-10T14:26:12Z
PR was https://github.com/dlang/phobos/pull/3827 (specified in the commit)
Comment #2 by code — 2016-08-10T18:03:03Z
At least the visibility warnings are related to Issue 15907 and should not appear, if people had correctly used `__traits(getMember, T, name)`.
Comment #3 by simen.kjaras — 2018-03-23T09:42:52Z