This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH for access buglet



Here's a for the accss problem Martin reported earlier.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1999-03-12  Mark Mitchell  <mark@markmitchell.com>

	* lex.c (do_identifier): Correct call to enforce_access.
	* search.c (accessible_p): Tweak comment.

Index: testsuite/g++.old-deja/g++.martin/access1.C
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/g++.old-deja/g++.martin/access1.C,v
retrieving revision 1.1
diff -c -p -r1.1 access1.C
*** access1.C	1999/03/12 05:18:20	1.1
--- access1.C	1999/03/13 00:34:28
***************
*** 1,12 ****
  // Build don't link:
  class A{
    public:
!     enum Foo{f1,f2}; // gets bogus error - XFAIL
  
      class B{
        friend class A;
        Foo f;
        public:
!         B():f(f1){}  // gets bogus error (inaccessible) - XFAIL
      };
  };
--- 1,12 ----
  // Build don't link:
  class A{
    public:
!     enum Foo{f1,f2};
  
      class B{
        friend class A;
        Foo f;
        public:
!         B():f(f1){} 
      };
  };
Index: testsuite/cp/lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/lex.c,v
retrieving revision 1.101
diff -c -p -r1.101 lex.c
*** lex.c	1999/03/09 23:02:36	1.101
--- lex.c	1999/03/13 00:34:37
*************** do_identifier (token, parsing, args)
*** 3045,3051 ****
      {
        /* Check access.  */
        if (IDENTIFIER_CLASS_VALUE (token) == id)
! 	enforce_access (current_class_type, id);
        if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id))
  	id = DECL_INITIAL (id);
      }
--- 3045,3051 ----
      {
        /* Check access.  */
        if (IDENTIFIER_CLASS_VALUE (token) == id)
! 	enforce_access (DECL_REAL_CONTEXT(id), id);
        if (!processing_template_decl || DECL_TEMPLATE_PARM_P (id))
  	id = DECL_INITIAL (id);
      }
Index: testsuite/cp/search.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/search.c,v
retrieving revision 1.85
diff -c -p -r1.85 search.c
*** search.c	1999/03/10 12:17:47	1.85
--- search.c	1999/03/13 00:34:39
*************** dfs_accessible_p (binfo, data)
*** 849,856 ****
  /* DECL is a declaration from a base class of TYPE, which was the
     classs used to name DECL.  Return non-zero if, in the current
     context, DECL is accessible.  If TYPE is actually a BINFO node,
!    then the most derived class along the path indicated by BINFO is
!    the one used to name the DECL.  */
  
  int 
  accessible_p (type, decl)
--- 849,856 ----
  /* DECL is a declaration from a base class of TYPE, which was the
     classs used to name DECL.  Return non-zero if, in the current
     context, DECL is accessible.  If TYPE is actually a BINFO node,
!    then we can tell in what context the access is occurring by looking
!    at the most derived class along the path indicated by BINFO.  */
  
  int 
  accessible_p (type, decl)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]