aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2002-05-20 10:31:38 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2002-05-20 10:31:38 +0000
commitecc42c14a7b3a9dd4b04c42b49f6da15e9c8cbf1 (patch)
tree2506b41b0616abacfbb4980eaa13d6b8646898ed /gcc
parentc0fe508e8b201c7789a66f252609a0f9006acfe9 (diff)
downloadgcc-ecc42c14a7b3a9dd4b04c42b49f6da15e9c8cbf1.zip
gcc-ecc42c14a7b3a9dd4b04c42b49f6da15e9c8cbf1.tar.gz
gcc-ecc42c14a7b3a9dd4b04c42b49f6da15e9c8cbf1.tar.bz2
call.c (any_strictly_viable): New.
* call.c (any_strictly_viable): New. (build_new_op): Use it for COMPOUND_EXPR and ADDR_EXPRs. From-SVN: r53656
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c32
2 files changed, 36 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5b0ccbf..0a48612 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-20 Alexandre Oliva <aoliva@redhat.com>
+
+ * call.c (any_strictly_viable): New.
+ (build_new_op): Use it for COMPOUND_EXPR and ADDR_EXPRs.
+
2002-05-19 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* error.c (dump_type) [TYPEOF_TYPE]: Fix parenthesis printing.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 233f98c..75fac88 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -62,6 +62,7 @@ static void print_z_candidates PARAMS ((struct z_candidate *));
static tree build_this PARAMS ((tree));
static struct z_candidate * splice_viable PARAMS ((struct z_candidate *));
static int any_viable PARAMS ((struct z_candidate *));
+static int any_strictly_viable PARAMS ((struct z_candidate *));
static struct z_candidate * add_template_candidate
PARAMS ((struct z_candidate *, tree, tree, tree, tree, tree, int,
unification_kind_t));
@@ -2319,6 +2320,16 @@ any_viable (cands)
return 0;
}
+static int
+any_strictly_viable (cands)
+ struct z_candidate *cands;
+{
+ for (; cands; cands = cands->next)
+ if (cands->viable == 1)
+ return 1;
+ return 0;
+}
+
static struct z_candidate *
splice_viable (cands)
struct z_candidate *cands;
@@ -3228,6 +3239,7 @@ build_new_op (code, flags, arg1, arg2, arg3)
enum tree_code code2 = NOP_EXPR;
tree templates = NULL_TREE;
tree conv;
+ bool viable_candidates;
if (arg1 == error_mark_node
|| arg2 == error_mark_node
@@ -3392,7 +3404,25 @@ build_new_op (code, flags, arg1, arg2, arg3)
(candidates, code, code2, fnname, args, flags);
}
- if (! any_viable (candidates))
+ switch (code)
+ {
+ case COMPOUND_EXPR:
+ case ADDR_EXPR:
+ /* For these, the built-in candidates set is empty
+ [over.match.oper]/3. We don't want non-strict matches
+ because exact matches are always possible with built-in
+ operators. The built-in candidate set for COMPONENT_REF
+ would be empty too, but since there are no such built-in
+ operators, we accept non-strict matches for them. */
+ viable_candidates = any_strictly_viable (candidates);
+ break;
+
+ default:
+ viable_candidates = any_viable (candidates);
+ break;
+ }
+
+ if (! viable_candidates)
{
switch (code)
{