[C++] Some name lookup questions

Giovanni Bajo giovannibajo@libero.it
Thu Oct 23 20:59:00 GMT 2003


Hello,

1) I can't find documentation on OVL_USED. Any hint about what it's supposed to
mean?

2) Given an OVERLOAD, I can't find a way to check whether the overloaded DECLs
come from using declarations or not, which is the culrpit of PR2294. Does GCC
really lose this information along the way? Do you think it would be sensible to
add something like OVL_FROM_USING_DECL()?

3) Do you think the below patch is legit? I'm asking mainly because of question
#1 above. I don't have a testcase yet, I found it while working on PR2294 and it
actually helps me there, but it needs other changes to show up:

Index: name-lookup.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.16
diff -c -p -r1.16 name-lookup.c
*** name-lookup.c       14 Oct 2003 20:34:41 -0000      1.16
--- name-lookup.c       23 Oct 2003 17:31:00 -0000
*************** push_overloaded_decl (tree decl, int fla
*** 1996,2007 ****

    if (old || TREE_CODE (decl) == TEMPLATE_DECL)
      {
        if (old && TREE_CODE (old) != OVERLOAD)
!       new_binding = ovl_cons (decl, ovl_cons (old, NULL_TREE));
        else
        new_binding = ovl_cons (decl, old);
        if (flags & PUSH_USING)
!       OVL_USED (new_binding) = 1;
      }
    else
      /* NAME is not ambiguous.  */
--- 1999,2020 ----

    if (old || TREE_CODE (decl) == TEMPLATE_DECL)
      {
+       tree intermediate = NULL_TREE;
+
        if (old && TREE_CODE (old) != OVERLOAD)
!       {
!         intermediate = ovl_cons (old, NULL_TREE);
!         new_binding = ovl_cons (decl, intermediate);
!       }
        else
        new_binding = ovl_cons (decl, old);
+
        if (flags & PUSH_USING)
!       {
!         OVL_USED (new_binding) = 1;
!         if (intermediate)
!           OVL_USED (intermediate) = 1;
!       }
      }
    else
      /* NAME is not ambiguous.  */


Thanks
Giovanni Bajo




More information about the Gcc mailing list