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]

Fix for g++.ns/lookup5.C


Namespaces that were first used indirectly and later directly are
currently not considered in qualified lookup. Here is the patch.

Martin

1998-07-16  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* decl2.c (add_using_namespace): When directly using a namespace
	that was indirect before, promote it.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.101
diff -c -p -r1.101 decl2.c
*** decl2.c	1998/07/15 17:27:17	1.101
--- decl2.c	1998/07/16 08:04:22
*************** add_using_namespace (user, used, indirec
*** 3857,3871 ****
       tree used;
       int indirect;
  {
!   tree iter;
    /* Using oneself is a no-op. */
    if (user == used)
      return;
    my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
    my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
    /* Check if we already have this. */
!   if (purpose_member (used, DECL_NAMESPACE_USING (user)) != NULL_TREE)
!     return;
  
    /* Add used to the user's using list. */
    DECL_NAMESPACE_USING (user) 
--- 3857,3877 ----
       tree used;
       int indirect;
  {
!   tree t;
    /* Using oneself is a no-op. */
    if (user == used)
      return;
    my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
    my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
    /* Check if we already have this. */
!   t = purpose_member (used, DECL_NAMESPACE_USING (user));
!   if (t != NULL_TREE)
!     {
!       if (!indirect)
! 	/* Promote to direct usage. */
! 	TREE_INDIRECT_USING (t) = 0;
!       return;
!     }
  
    /* Add used to the user's using list. */
    DECL_NAMESPACE_USING (user) 
*************** add_using_namespace (user, used, indirec
*** 3879,3891 ****
      = perm_tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
  
    /* Recursively add all namespaces used. */
!   for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
      /* indirect usage */
!     add_using_namespace (user, TREE_PURPOSE (iter), 1);
  
    /* Tell everyone using us about the new used namespaces. */
!   for (iter = DECL_NAMESPACE_USERS (user); iter; iter = TREE_CHAIN (iter))
!     add_using_namespace (TREE_PURPOSE (iter), used, 1);
  }
  
  /* Combines two sets of overloaded functions into an OVERLOAD chain.
--- 3885,3897 ----
      = perm_tree_cons (user, 0, DECL_NAMESPACE_USERS (used));
  
    /* Recursively add all namespaces used. */
!   for (t = DECL_NAMESPACE_USING (used); t; t = TREE_CHAIN (t))
      /* indirect usage */
!     add_using_namespace (user, TREE_PURPOSE (t), 1);
  
    /* Tell everyone using us about the new used namespaces. */
!   for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
!     add_using_namespace (TREE_PURPOSE (t), used, 1);
  }
  
  /* Combines two sets of overloaded functions into an OVERLOAD chain.



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