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]

MAINLINE PATCH: Arguments And Jousting


When determining whether one template function is more specialized
than another template function, more_specialized() is passed the
number of function arguments to consider.  The 'this' argument is
treated specially for constructors.

Compiling a Pooma 2.3.0 example revealed the error.

2001-02-26  Jeffrey Oldham  <oldham@codesourcery.com>

	* call.c (joust): Ensure more_specialized()'s argument length
	parameter has correct value for constructors.

Tested on	i686-pc-linux-gnu, building c++ and libstdc++-v3 and C++ tests
Approved by	Mark Mitchell (mark@codesourcery.com)

Thanks,
Jeffrey D. Oldham
oldham@codesourcery.com
Index: call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.261
diff -c -p -r1.261 call.c
*** call.c	2001/02/18 19:07:58	1.261
--- call.c	2001/02/21 21:04:13
*************** joust (cand1, cand2, warn)
*** 5221,5234 ****
        winner = more_specialized
          (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template),
           DEDUCE_ORDER,
!          /* Tell the deduction code how many real function arguments we saw,
! 	    not counting the implicit 'this' argument.
  
  	    [temp.func.order]: The presence of unused ellipsis and default
  	    arguments has no effect on the partial ordering of function
  	    templates.  */
           TREE_VEC_LENGTH (cand1->convs)
!          - DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn));
        if (winner)
          return winner;
      }
--- 5221,5237 ----
        winner = more_specialized
          (TI_TEMPLATE (cand1->template), TI_TEMPLATE (cand2->template),
           DEDUCE_ORDER,
!          /* Tell the deduction code how many real function arguments
! 	    we saw, not counting the implicit 'this' argument.  But,
! 	    add_function_candidate() suppresses the "this" argument
! 	    for constructors.
  
  	    [temp.func.order]: The presence of unused ellipsis and default
  	    arguments has no effect on the partial ordering of function
  	    templates.  */
           TREE_VEC_LENGTH (cand1->convs)
! 	 - (DECL_NONSTATIC_MEMBER_FUNCTION_P (cand1->fn)
! 	    -DECL_CONSTRUCTOR_P (cand1->fn)));
        if (winner)
          return winner;
      }

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