Topic: Access control on default parameters.
Author: kanze@gabi-soft.fr (J. Kanze)
Date: 1995/09/05 Raw View
According to the draft standard: ``In member function declarations,
names in default argument expressins are looked up in the scope of the
class like names in member function bodies.'' (Section 8.3.6, para. 6.)
Does this mean that access rights are also checked as if the name were
in a member function body? In sum, is the following code legal:
class X
{
public :
class Y
{
} ;
X( Y a = dfltA ) ;
private :
static Y dfltA ;
} ;
void
f()
{
X x ;
}
I would normally think not, since normally access checking is orthogonal
to name lookup/scope resolution. But the compilers I have access to
disagree.
(Steve, Mike: two of the compilers which disagree are originally from
Taumet. Did you guys change your minds somewhere along the line? And
if Sun CC represents your latest thinking, then your evolution is in
just the opposite direction of g++; the current g++ refuses this, but if
memory serves me right, older versions accepted it.)
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils en informatique industrielle--
--Beratung in industrieller Datenverarbeitung
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]