public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16617] New: Fail to do access checking correctly for non-dependent qualified-id
@ 2004-07-18 13:52 lerdsuwa at gcc dot gnu dot org
  2004-07-18 19:46 ` [Bug c++/16617] " giovannibajo at libero dot it
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-07-18 13:52 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <bug-16617-16@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-16617-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-04-22 17:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-18 13:52 [Bug c++/16617] New: Fail to do access checking correctly for non-dependent qualified-id lerdsuwa at gcc dot gnu dot org
2004-07-18 19:46 ` [Bug c++/16617] " giovannibajo at libero dot it
2004-07-28 13:48 ` bangerth at dealii dot org
2004-12-12 12:42 ` lerdsuwa at gcc dot gnu dot org
2005-01-12 10:50 ` lerdsuwa at gcc dot gnu dot org
2005-04-23 15:30 ` lerdsuwa at gcc dot gnu dot org
2005-05-19 17:09 ` lerdsuwa at gcc dot gnu dot org
2005-06-07 14:59 ` lerdsuwa at gcc dot gnu dot org
     [not found] <bug-16617-16@http.gcc.gnu.org/bugzilla/>
2009-04-29  7:05 ` pinskia at gcc dot gnu dot org
2009-04-29  7:05 ` pinskia at gcc dot gnu dot org
     [not found] <bug-16617-4@http.gcc.gnu.org/bugzilla/>
2021-04-22 17:41 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:45 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).