From da964feac45702899e5e8cfffb0d78bdb5759b80 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Feb 2009 14:14:07 -0500 Subject: re PR c++/39070 (ICE with typeof() (... and __decltype)) PR c++/39070 * semantics.c (finish_call_expr): Change koenig_p parm to int. If -1, don't set KOENIG_LOOKUP_P but do keep hidden candidates. * cp-tree.h: Adjust prototype. * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Pass -1. From-SVN: r144161 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/cp-tree.h | 2 +- gcc/cp/pt.c | 4 ++-- gcc/cp/semantics.c | 10 +++++++--- 4 files changed, 18 insertions(+), 6 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7ead4b2..d9d6866 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2009-02-13 Jason Merrill + + PR c++/39070 + * semantics.c (finish_call_expr): Change koenig_p parm to int. + If -1, don't set KOENIG_LOOKUP_P but do keep hidden candidates. + * cp-tree.h: Adjust prototype. + * pt.c (tsubst_copy_and_build) [CALL_EXPR]: Pass -1. + 2009-02-12 Jason Merrill PR c++/38950 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5a9b891..b23a396 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4757,7 +4757,7 @@ extern tree finish_stmt_expr_expr (tree, tree); extern tree finish_stmt_expr (tree, bool); extern tree stmt_expr_value_expr (tree); extern tree perform_koenig_lookup (tree, tree); -extern tree finish_call_expr (tree, tree, bool, bool, +extern tree finish_call_expr (tree, tree, bool, int, tsubst_flags_t); extern tree finish_increment_expr (tree, enum tree_code); extern tree finish_this_expr (void); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index db8886c..81eaffe 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11404,12 +11404,12 @@ tsubst_copy_and_build (tree t, /*fn_p=*/NULL, complain)); } - /* Pass true for koenig_p so that build_new_function_call will + /* Pass -1 for koenig_p so that build_new_function_call will allow hidden friends found by arg-dependent lookup at template parsing time. */ return finish_call_expr (function, call_args, /*disallow_virtual=*/qualified_p, - /*koenig_p*/true, + /*koenig_p*/-1, complain); } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 55b0bae..dfff09b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1839,10 +1839,14 @@ perform_koenig_lookup (tree fn, tree args) qualified. For example a call to `X::f' never generates a virtual call.) + KOENIG_P is 1 if we want to perform argument-dependent lookup, + -1 if we don't, but we want to accept functions found by previous + argument-dependent lookup, and 0 if we want nothing to do with it. + Returns code for the call. */ tree -finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p, +finish_call_expr (tree fn, tree args, bool disallow_virtual, int koenig_p, tsubst_flags_t complain) { tree result; @@ -1865,7 +1869,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p, || any_type_dependent_arguments_p (args)) { result = build_nt_call_list (fn, args); - KOENIG_LOOKUP_P (result) = koenig_p; + KOENIG_LOOKUP_P (result) = koenig_p > 0; if (cfun) { do @@ -1955,7 +1959,7 @@ finish_call_expr (tree fn, tree args, bool disallow_virtual, bool koenig_p, if (!result) /* A call to a namespace-scope function. */ - result = build_new_function_call (fn, args, koenig_p, complain); + result = build_new_function_call (fn, args, koenig_p != 0, complain); } else if (TREE_CODE (fn) == PSEUDO_DTOR_EXPR) { -- cgit v1.1