This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16617] New: Fail to do access checking correctly for non-dependent qualified-id
- From: "lerdsuwa at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jul 2004 13:52:32 -0000
- Subject: [Bug c++/16617] New: Fail to do access checking correctly for non-dependent qualified-id
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is a spin out of a problem mentioned in PR13092.
The following testcase shouldn't compile because only
fr<int> is friend of class D. But we are accessing
protected members from fr<char>. GCC 3.4, 3.5 fail
to diagnose it. Earlier GCC don't handle this properly
(checking access while parsing the template fr<T> which
is too early.) So it's not a regression.
// Two-phase name lookup for address of member:
// Protected member access
class B
{
protected:
int i; // { dg-error "protected" }
};
template <class T> void fr ();
class D2 : public B
{
friend void fr<int> ();
};
template<int B::*> struct X
{};
template <class T> void fr ()
{
X<&B::i> x1; // { dg-error "context" }
X<&D2::i> x2; // { dg-error "context" }
}
template void fr<char>(); // { dg-error "instantiated" }
--
Summary: Fail to do access checking correctly for non-dependent
qualified-id
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lerdsuwa at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16617