aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@gcc.gnu.org>2016-04-13 00:06:51 +0000
committerPatrick Palka <ppalka@gcc.gnu.org>2016-04-13 00:06:51 +0000
commit92886d3e86cb7b2f83cfc9724cb527ab8032aed8 (patch)
tree2c6544cbcec2e437adb45867ccd31332d79effc8 /gcc/cp
parentd90936ff88545c9312a0137725a9b1ab0919ad48 (diff)
downloadgcc-92886d3e86cb7b2f83cfc9724cb527ab8032aed8.zip
gcc-92886d3e86cb7b2f83cfc9724cb527ab8032aed8.tar.gz
gcc-92886d3e86cb7b2f83cfc9724cb527ab8032aed8.tar.bz2
Fix PR c++/70610 (wrong overload resolution during template processing)
gcc/cp/ChangeLog: PR c++/70610 * tree.c (lvalue_kind) [NON_DEPENDENT_EXPR]: Unconditionally recurse into it. * typeck.c (build_x_conditional_expr): Unconditionally remember that the result is an lvalue or xvalue. gcc/testsuite/ChangeLog: PR c++/70610 * g++.dg/template/pr70610.C: New test. * g++.dg/template/pr70610-2.C: New test. * g++.dg/template/pr70610-3.C: New test. * g++.dg/template/pr70610-4.C: New test. From-SVN: r234926
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/tree.c8
-rw-r--r--gcc/cp/typeck.c6
3 files changed, 11 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 823ab11..5696eea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2016-04-12 Patrick Palka <ppalka@gcc.gnu.org>
+
+ PR c++/70610
+ * tree.c (lvalue_kind) [NON_DEPENDENT_EXPR]: Unconditionally
+ recurse into it.
+ * typeck.c (build_x_conditional_expr): Unconditionally remember
+ that the result is an lvalue or xvalue.
+
2016-04-12 Jason Merrill <jason@redhat.com>
* class.c (is_really_empty_class): A zero-length array is empty.
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5d9de34..df2981f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -224,13 +224,7 @@ lvalue_kind (const_tree ref)
return lvalue_kind (BASELINK_FUNCTIONS (CONST_CAST_TREE (ref)));
case NON_DEPENDENT_EXPR:
- /* We just return clk_ordinary for NON_DEPENDENT_EXPR in C++98, but
- in C++11 lvalues don't bind to rvalue references, so we need to
- work harder to avoid bogus errors (c++/44870). */
- if (cxx_dialect < cxx11)
- return clk_ordinary;
- else
- return lvalue_kind (TREE_OPERAND (ref, 0));
+ return lvalue_kind (TREE_OPERAND (ref, 0));
default:
if (!TREE_TYPE (ref))
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9e61090..cef5604 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6275,10 +6275,8 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
{
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);
- /* In C++11, remember that the result is an lvalue or xvalue.
- In C++98, lvalue_kind can just assume lvalue in a template. */
- if (cxx_dialect >= cxx11
- && lvalue_or_rvalue_with_address_p (expr)
+ /* Remember that the result is an lvalue or xvalue. */
+ if (lvalue_or_rvalue_with_address_p (expr)
&& !lvalue_or_rvalue_with_address_p (min))
TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
!real_lvalue_p (expr));