This is the mail archive of the 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]

[RFC] Patch to fix Infinite Stack Recursion Regression

Attached test case causes infinite stack recursion with gcc mainline. It is cause by fix to PR17413. Test should issue a diagnostic instead.

Before the patch:
% mygccm5plus -c local6.C
Out of stack space.
Try running 'limit stacksize unlimited' in the shell to raise its limit.

With the patch:
% mygcctplus !*
mygcctplus -c local6.C
local6.C: In member function 'PCVector2<T> PCVector2<T>::operator- (const PCVector2<T>&) const [with T = double]':
local6.C:18: instantiated from here
local6.C:7: error: no matching function for call to 'PCVector2<double>::PCVector2(const double&, const double&)'
local6.C:2: note: candidates are: PCVector2<double>::PCVector2(const PCVector2<double>&)

Attached patch (against apple's local branch) fixes it. If it looks reasonable, I will provide an FSF patch. This patch has been bootstrapped and dejagnu++ tested on apple-ppc-branch.
Bug introduced when gcc-4.0 started doing template deduction on arguments which do not depend on template argument. Call to can_convert_arg is made for this purpose. Part of type checking involves call to implicit_conversion which then calls build_user_type_conversion_1 to find a candidate for type conversion. But to find such a convesion, look up must be only looking for non- converting constructors. This is accomplished by passing LOOKUP_ONLYCONVERTING flag to build_user_type_conversion_1. Bug is that this flag gets passed down all the way to add_template_candidate_real, but not further. Fix is to pass this flag further down to fn_type_unification and to
type_unification_real, called by fn_type_unification, so next search for doing non-template dependent argument deduction is done in this lookup mode.

- fariborz (


2005-07-25 Fariborz Jahanian <>

* cp-tree.h (can_convert_arg, fn_type_unification): New argument.
* call.c (add_template_candidate_real): Pass down 'flags' to
(can_convert_arg): New 'flags' argument. Pass it to call to
implicit_conversion instead of LOOKUP_NORMAL.
* class.c (resolve_address_of_overloaded_function): Add
LOOKUP_NORMAL in call to can_convert_arg.
(resolve_address_of_overloaded_function): Ditto.
* decl.c (reshape_init, check_default_argument): Ditto.
* typeck.c (build_ptrmemfunc): Ditto.
* typeck2.c (digest_init): Ditto.
(unify): Add LOOKUP_NORMAL to call to type_unification_real.
* pt.c (type_unification_real): Add 'flags' argument.
(fn_type_unification): Pass 'flags' to type_unification_real.
(type_unification_real): Pass new 'flags' argument to call to

Attachment: radar-patch-4187916.txt
Description: Text document

Attachment: local6.C
Description: Binary data

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