On Sunday, December 23, 2012 23:41:35 Jonathan M Davis wrote: > Also, making the compiler take the most accessible function is _wrong_. In > the example above, if bar were in the same module as S, it would then call > the public foo, whereas if it were in another module, you'd get an error > (assuming that inaccessible functions are still kept in overload sets). If > multiple overloads of a function are accessible and they conflict, then > they should conflict. It's definitely hijacking if you just grab the most > accessible one.
Okay. I didn't think that through enough. This analysis of the example is wrong. Rather, what would happen if the most accessible overload is taken first (as you (Martin) seem to be suggesting), then the private version would never be called, as the public one would win out, which _is_ very broken. And I wouldn't think that you'd be suggesting something that broken, so I must be misunderstanding what you're suggesting. I don't think that accessibility should enter into function overloading at all beyond the fact that inaccessible functions are left out of overload sets. - Jonathan M Davis