This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19258] New: Incorrect access check for default argument
- From: "austern at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jan 2005 19:38:01 -0000
- Subject: [Bug c++/19258] New: Incorrect access check for default argument
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code
class X {
template<class T> friend int ff(T*, int y=anX.x) { return y; }
int f() { return ff(&anX); }
static X anX;
int x;
};
X dummy;
gives an error message with mainline:
foo.cc:6: error: 'int X::x' is private
foo.cc:3: error: within this context
That error message doesn't make sense. The only relevant contexts are that of X::f (in which x may be
accessed, since X has access to its own members) and that of ff (which has access because it is a friend
of X.) The analogous non-template case compiles correctlly.
This is a regression from 3.3.
--
Summary: Incorrect access check for default argument
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.7.0
GCC host triplet: powerpc-apple-darwin7.7.0
GCC target triplet: powerpc-apple-darwin7.7.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19258