On 22/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > On Thu May 22 2008 06:34:27 Jordi Gutiérrez Hermoso wrote: > > The first thing to note is that neither of these is your original > example, so it would be better if you had written "the *only* > difference between the two examples above is the access specifiers".
The only difference is I added a "using A::f" > You then complain that it doesn't work when you try to "using" a > private function. No, I am "using" a function that is both overloaded to private and public. But the compiler gets confused depending on the access specifier. Why should it attempt to use the private function when the access specifier is public but will happily use the public function when the access specifier is public? You keep talking about scope. The access specifier should affect scope and name resolution? This does not make sense! The public function is available, a using declaration should bring that function from A's scope into B's scope, but the compiler tries to resolve the call "b.f(a)" call to the inaccessible private function anyways. Why should this make sense? For the record, both of the snippets above compile on the Comeau C++ compiler, furthering my suspicion that this is a gcc bug. > Had you quoted the compiler's message to you, > which was probably "error: 'virtual void A::f(foo)' is private", I thought you could easily run the programs yourself and see the compiler error for yourself. > it would be immediately obvious that EITHER you know nothing of C++ > INCLUSIVE OR you're deliberately wasting bandwidth on this list. No, I'm just loudmouthed, just as much as you are, and I yell a little less, too ;-) > > > But the best solution is to read up on WHY C++ works this way so > > > you can understand the implications that thousands of great minds > > > have already pondered. > > > > Well, those great minds seem to be too great for me to fathom, because > > I really don't see why it seems here that a function's signature isn't > > enough to specify it, and they saw it fit to make sure I couldn't both > > I overload and inherit three related but different functions. > > > Exactly. Overload ambiguities are resolved in scope, not beyond. Why do g++ and Comeau disagree here? Shouldn't the using declaration bring A's functions into scope? Why is it that supposedly bringing them into scope still results in g++ trying to call the inaccessible private function and that making that inaccessible private function public suddenly results in g++ calling the right function that was public all along? > Thousands of people, some of them much smarter than > you or I, have not only decided that C++ should do this (which could > be a bug) but explained at great length and in great detail why C++ > works this way (thus showing that it is not a bug). Bah. Thousands of people could never be wrong, eh? Anyways, I don't think this is thousands of people being wrong, but just the g++ devs making a small mistake. > You have been given a precise reference to a good example of such an > explanation but you ignore it. Inaccessible. I don't have that book, and it's not in my local library. > This was offtopic anyway. I labelled it as such, so that those who didn't want to read about it could ignore it. > if you still have questions address them to a C++ forum. I've done that, but I thought I could pick the brains of Debian users anyways. If your brain is not available for picking, then just ignore this thread. - Jordi G. H. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]