diff options
| author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-05 12:53:52 +0000 | 
|---|---|---|
| committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-05 12:53:52 +0000 | 
| commit | c682aadfbdce0184e90aca968b87729cf26c38f7 (patch) | |
| tree | 8f692d3a97ff18f16f19e7b81c5e5b61d15efcfe /gcc | |
| parent | 026b7f6ff094c0483286fe2fd8f79bd5d4c884ae (diff) | |
| download | ppe42-gcc-c682aadfbdce0184e90aca968b87729cf26c38f7.tar.gz ppe42-gcc-c682aadfbdce0184e90aca968b87729cf26c38f7.zip | |
cp:
	* call.c (build_user_type_conversion_1): Set ICS_USER_FLAG and
	ICS_BAD_FLAG on created conversion.
	(compare_ics): Break out rank.
testsuite:
	* g++.old-deja/g++.other/conv7.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42907 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/call.c | 16 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/conv7.C | 45 | 
4 files changed, 66 insertions, 5 deletions
| diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 970f787b101..f4e08d603f3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@  2001-06-05  Nathan Sidwell  <nathan@codesourcery.com> +	* call.c (build_user_type_conversion_1): Set ICS_USER_FLAG and +	ICS_BAD_FLAG on created conversion. +	(compare_ics): Break out rank. + +2001-06-05  Nathan Sidwell  <nathan@codesourcery.com> +  	* decl.c (xref_tag): Remove extraneous %s on dependent name  	lookup warning. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 5367cc55805..f2478ed5e6e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -2521,9 +2521,10 @@ build_user_type_conversion_1 (totype, expr, flags)       (DECL_CONSTRUCTOR_P (cand->fn)        ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))),       expr, build_ptr_wrapper (cand)); -  ICS_USER_FLAG (cand->second_conv) = 1; +   +  ICS_USER_FLAG (cand->second_conv) = ICS_USER_FLAG (*p) = 1;    if (cand->viable == -1) -    ICS_BAD_FLAG (cand->second_conv) = 1; +    ICS_BAD_FLAG (cand->second_conv) = ICS_BAD_FLAG (*p) = 1;    return cand;  } @@ -4799,6 +4800,7 @@ compare_ics (ics1, ics2)    tree deref_from_type2 = NULL_TREE;    tree deref_to_type1 = NULL_TREE;    tree deref_to_type2 = NULL_TREE; +  int rank1, rank2;    /* REF_BINDING is non-zero if the result of the conversion sequence       is a reference type.   In that case TARGET_TYPE is the @@ -4828,13 +4830,17 @@ compare_ics (ics1, ics2)       --a user-defined conversion sequence (_over.ics.user_) is a         better conversion sequence than an ellipsis conversion sequence         (_over.ics.ellipsis_).  */ -  if (ICS_RANK (ics1) > ICS_RANK (ics2)) +  rank1 = ICS_RANK (ics1); +  rank2 = ICS_RANK (ics2); +   +  if (rank1 > rank2)      return -1; -  else if (ICS_RANK (ics1) < ICS_RANK (ics2)) +  else if (rank1 < rank2)      return 1; -  if (ICS_RANK (ics1) == BAD_RANK) +  if (rank1 == BAD_RANK)      { +      /* XXX Isn't this an extension? */        /* Both ICS are bad.  We try to make a decision based on what  	 would have happenned if they'd been good.  */        if (ICS_USER_FLAG (ics1) > ICS_USER_FLAG (ics2) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14ca76fd5bc..0732fb38b07 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-06-05  Nathan Sidwell  <nathan@codesourcery.com> + +	* g++.old-deja/g++.other/conv7.C: New test. +  2001-06-05  Joseph S. Myers  <jsm28@cam.ac.uk>  	* gcc.c-torture/compile/20010605-2.c: New test. diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv7.C b/gcc/testsuite/g++.old-deja/g++.other/conv7.C new file mode 100644 index 00000000000..0a7e76dfe3f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/conv7.C @@ -0,0 +1,45 @@ +// Build don't link: +//  +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 May 2001 <nathan@codesourcery.com> + +// Bug 2726. We ICE'd trying to say something about possibly confusing +// conversion overload resolution. + +class foo +{ +}; + +template<class T> +class bar +{ +public: +    operator const T&() const ; +    operator T&() ; + +}; + + +template<class T, class Ref, class NodePtr, class ListPtr> +class iterator_template +{ +public: +    iterator_template(); +    Ref operator*() const; + +}; + +struct IdlDeclarator +{ +}; + +typedef bar< IdlDeclarator > IdlDeclarator_bar; +int +yyparse() + +{ + +  iterator_template<IdlDeclarator_bar,IdlDeclarator_bar&,foo*,foo*> declIter; +  const IdlDeclarator& declarator = *declIter; // WARNING - choosing +  return 1; +} | 

