User account creation filtered due to spam.

Bug 16617 - Fail to do access checking correctly for non-dependent qualified-id
Summary: Fail to do access checking correctly for non-dependent qualified-id
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: accepts-invalid
: 24118 33934 (view as bug list)
Depends on:
Blocks: 13495
  Show dependency treegraph
Reported: 2004-07-18 13:52 UTC by Kriang Lerdsuwanakij
Modified: 2016-01-20 02:51 UTC (History)
7 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-04-22 05:12:13


Note You need to log in before you can comment on or make changes to this bug.
Description Kriang Lerdsuwanakij 2004-07-18 13:52:32 UTC
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
  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" }
Comment 1 Wolfgang Bangerth 2004-07-28 13:48:57 UTC
Comment 2 Kriang Lerdsuwanakij 2004-12-12 12:42:31 UTC
Got it.  The target for this fix is GCC 4.1.
Comment 3 Kriang Lerdsuwanakij 2005-01-12 10:50:37 UTC
May be fixed together with PR19311.
Comment 4 Kriang Lerdsuwanakij 2005-04-23 15:30:17 UTC
This is a stage 2 project.  Likely to be fixed in a month or two.
Comment 5 Kriang Lerdsuwanakij 2005-05-19 17:09:02 UTC
Patch using new approach for 4.1:
(Note this is part 4 in a series, earlier parts are also required)
Comment 6 Kriang Lerdsuwanakij 2005-06-07 14:58:59 UTC
Patch withdrawn due to overlooking default function argument and default
template argument. No nice solution is found yet.
Comment 7 Andrew Pinski 2009-04-29 07:05:07 UTC
*** Bug 33934 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2009-04-29 07:05:41 UTC
*** Bug 24118 has been marked as a duplicate of this bug. ***