aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-11-08 12:10:09 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-11-08 12:10:09 -0500
commitca8dc274736dce2046bb557f7b5c5a5d0193fb3c (patch)
tree3e07a425ce3f8dbc0b60c88f2ef81e9501ce6e22 /gcc/cp/tree.c
parente55cef40ed1f6f5b2a9933e0256ea23e66b1806c (diff)
downloadgcc-ca8dc274736dce2046bb557f7b5c5a5d0193fb3c.zip
gcc-ca8dc274736dce2046bb557f7b5c5a5d0193fb3c.tar.gz
gcc-ca8dc274736dce2046bb557f7b5c5a5d0193fb3c.tar.bz2
re PR c++/50835 (Lvalue-ness of conditional operator results is incorrect in a function template)
PR c++/50835 * typeck.c (build_x_conditional_expr): Preserve lvalue/xvalueness. * tree.c (lvalue_kind) [NON_DEPENDENT_EXPR]: Return clk_ordinary in C++98. From-SVN: r181174
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index dc9fc95..841029f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -203,10 +203,13 @@ lvalue_kind (const_tree ref)
return lvalue_kind (BASELINK_FUNCTIONS (CONST_CAST_TREE (ref)));
case NON_DEPENDENT_EXPR:
- /* We used to just return clk_ordinary for NON_DEPENDENT_EXPR because
- it was safe enough for C++98, but in C++0x lvalues don't bind to
- rvalue references, so we get bogus errors (c++/44870). */
- return lvalue_kind (TREE_OPERAND (ref, 0));
+ /* 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 < cxx0x)
+ return clk_ordinary;
+ else
+ return lvalue_kind (TREE_OPERAND (ref, 0));
default:
if (!TREE_TYPE (ref))