Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!att!cbnewsl!strange From: strange@cbnewsl.ATT.COM (philip.e.brown) Newsgroups: comp.lang.c++ Subject: Re: Ambiguity and Access Control Message-ID: <2944@cbnewsl.ATT.COM> Date: 19 Nov 89 18:02:46 GMT References: <4051@cadillac.CAD.MCC.COM> Reply-To: strange@cbnewsl.ATT.COM (philip.e.brown,sf,) Distribution: na Organization: AT&T Bell Laboratories Lines: 47 In article <4051@cadillac.CAD.MCC.COM> dsouza@mcc.com writes: > > >In 2.0, is ambiguity checked independently (before) access control. >If so, WHY ? Yes. Access could easily be checked before ambiguity if C++ only supported class data members (one name, one member). However, C++ also has function members (one name, many members). Currently, lookup applies to a name, whereas access control applies to a member. Bridging this gap are the rules for overloaded function matching. So, you have something like (1) name lookup (2) matching (3) access control where "matching" for a data member is a no-op. The ambiguity check currently happens at the end of (1). The question is then, "Why can't all three steps be combined into one to avoid ambiguities?" Basically, you can't always do the matching before the ambiguity check. Consider class C { int f(int); public: int f(double); }; int (C::*pmf)(int) = &C::f; The expression "C::f" must provide an unambiguous name even though the matching and access check cannot be done until the initialization of "pmf". -------- Phil Brown strange@attunix.att.com