This is the mail archive of the gcc@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]
Other format: [Raw text]

[C++] Some name lookup questions


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



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