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
+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
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)
+2009-08-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/41131
+ * g++.dg/expr/unary3.C: New test.
+
2009-08-21 Kaz Kojima <kkojima@gcc.gnu.org>
* gfortran.dg/common_5.f: Add -mdalign for sh.
--- /dev/null
+// PR c++/41131
+// { dg-do compile }
+
+struct X { enum E { a = 100 }; };
+
+int
+main ()
+{
+ X x;
+ (void) &x.a; // { dg-error "lvalue required" }
+}