Fix PR c++/21802 (two-stage name lookup fails for operators)
authorPatrick Palka <ppalka@gcc.gnu.org>
Tue, 15 Dec 2015 03:33:53 +0000 (03:33 +0000)
committerPatrick Palka <ppalka@gcc.gnu.org>
Tue, 15 Dec 2015 03:33:53 +0000 (03:33 +0000)
commitfcb9363eb9ba94b8e157444dc7ac2c93e69d6c58
tree91059fe54587a7f7fd54738db81ccbb8f1b6cdfc
parent8d3586e4e2426a2ae77c082134be67fe036c87a7
Fix PR c++/21802 (two-stage name lookup fails for operators)

gcc/cp/ChangeLog:

PR c++/21802
PR c++/53223
* cp-tree.h (cp_tree_code_length): Declare.
(build_min_non_dep_op_overload): Declare.
* tree.c (cp_tree_code_length): Define.
(build_min_non_dep_op_overload): Define.
(build_win_non_dep_call_vec): Copy the KOENIG_LOOKUP_P flag.
* typeck.c (build_x_indirect_ref): Use
build_min_non_dep_op_overload when the given expression
has been resolved to an operator overload.
(build_x_binary_op): Likewise.
(build_x_array_ref): Likewise.
(build_x_unary_op): Likewise.
(build_x_compound_expr): Likewise.
(build_x_modify_expr): Likewise.
* decl2.c (grok_array_decl): Likewise.
* call.c (build_new_op_1): If during template processing we
chose an operator overload that is a hidden friend function, set
the call's KOENIG_LOOKUP_P flag to 1.

gcc/testsuite/ChangeLog:

PR c++/21802
PR c++/53223
* g++.dg/cpp0x/pr53223.C: New test.
* g++.dg/lookup/pr21802.C: New test.
* g++.dg/lookup/two-stage4.C: Remove XFAIL.

From-SVN: r231640
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr53223.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/pr21802.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/two-stage4.C