"Nick Sabalausky" <[email protected]> wrote in message news:[email protected]... > "Adam D. Ruppe" <[email protected]> wrote in message > news:[email protected]... >> There's no way I've found, aside from direct access (so not via >> getMembers) and seeing it it fails to compile. >> > > I just gave it a try. I think I may be hitting against a bug in > __traits(compiles) WRT private. This is the best I could get (Using DMD > 2.054, Win): > > > Note that "auto y = &(foo.d);" fails to compile as expected, but > __traits(compiles) claims that should compile. It works for the > non-function members though. > > I did the "auto x = &(...);" trick so I wouldn't have to deal with the > function's params. Maybe you know how to put dummy args in and make it an > actual function call instead of taking the func's address? That's probably > be a pain, but maybe it would get around the bug. >
Oops, I misread the line number. The line "auto y = &(foo.d);" DOES compile. So it's not a bug in __traits(compiles). But it may simply be a bug in private. In other words: Taking the address of a private member function (from some other module) is currently allowed (but seems wrong to me). If that's fixed, then my code *should* work. But private has practically never worked anyway :(
