summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-08-21 09:08:15 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-08-21 09:08:15 +0200
commit4b8c1a924a55851b83b26391e1703bd15c1c4066 (patch)
treecc929624ef664c93f476c71caca5a8af29973dc1 /gcc/cp
parent7450a081dba0e01ad1097e8d4798fe59f91ecead (diff)
downloadgcc-4b8c1a924a55851b83b26391e1703bd15c1c4066.tar.gz
re PR c++/41131 (non-lvalue in unary `&' wrongly accepted)
PR c++/41131 * tree.c (lvalue_p_1) <case CONST_DECL>: Return clk_none if not TREE_STATIC. * g++.dg/expr/unary3.C: New test. From-SVN: r150985
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7112a67df67..545ac188741 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/41131
+ * tree.c (lvalue_p_1) <case CONST_DECL>: Return clk_none if
+ not TREE_STATIC.
+
2009-08-19 Jason Merrill <jason@redhat.com>
PR c++/41119
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 1a406a30690..f09b036e334 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -132,6 +132,12 @@ lvalue_p_1 (const_tree ref)
return clk_ordinary;
case CONST_DECL:
+ /* CONST_DECL without TREE_STATIC are enumeration values and
+ thus not lvalues. With TREE_STATIC they are used by ObjC++
+ in objc_build_string_object and need to be considered as
+ lvalues. */
+ if (! TREE_STATIC (ref))
+ return clk_none;
case VAR_DECL:
if (TREE_READONLY (ref) && ! TREE_STATIC (ref)
&& DECL_LANG_SPECIFIC (ref)