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]
Other format: [Raw text]

C++ PATCH for c++/9420


We were being overeager about instantiating classes used in a conversion;
if LOOKUP_NO_CONVERSION is set, we don't care about user-defined
conversions.

Tested i686-pc-linux-gnu, applied to trunk and 3.3.  Test in
g++.dg/template/overload1.C.

2003-03-13  Jason Merrill  <jason at redhat dot com>

	PR c++/9420
	* search.c (lookup_conversions): Call complete_type here.
	* call.c (implicit_conversion): Not here.

*** call.c.~1~	2003-03-13 16:05:13.000000000 -0500
--- call.c	2003-03-13 16:27:43.000000000 -0500
*************** implicit_conversion (tree to, tree from,
*** 1305,1315 ****
        || expr == error_mark_node)
      return NULL_TREE;
  
-   /* Make sure both the FROM and TO types are complete so that
-      user-defined conversions are available.  */
-   complete_type (from);
-   complete_type (to);
- 
    if (TREE_CODE (to) == REFERENCE_TYPE)
      conv = reference_binding (to, from, expr, flags);
    else
--- 1305,1310 ----
*** search.c.~1~	2003-03-13 16:05:13.000000000 -0500
--- search.c	2003-03-13 16:03:49.000000000 -0500
*************** lookup_conversions (tree type)
*** 2271,2278 ****
    tree t;
    tree conversions = NULL_TREE;
  
!   if (COMPLETE_TYPE_P (type))
!     bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions);
  
    for (t = conversions; t; t = TREE_CHAIN (t))
      IDENTIFIER_MARKED (DECL_NAME (OVL_CURRENT (TREE_VALUE (t)))) = 0;
--- 2271,2278 ----
    tree t;
    tree conversions = NULL_TREE;
  
!   complete_type (type);
!   bfs_walk (TYPE_BINFO (type), add_conversions, 0, &conversions);
  
    for (t = conversions; t; t = TREE_CHAIN (t))
      IDENTIFIER_MARKED (DECL_NAME (OVL_CURRENT (TREE_VALUE (t)))) = 0;

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