commit 8ae67357954e593b1ce19c2fc570ccee0259668e
Author: Jason Merrill <jason@redhat.com>
Date: Sat May 21 22:15:06 2011 -0400
PR c++/49092
* dwarf2out.c (tree_add_const_value_attribute_for_decl): Check for
static storage duration.
@@ -17719,7 +17719,9 @@ tree_add_const_value_attribute_for_decl (dw_die_ref var_die, tree decl)
if (!decl
|| (TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != CONST_DECL))
+ && TREE_CODE (decl) != CONST_DECL)
+ || (TREE_CODE (decl) == VAR_DECL
+ && !TREE_STATIC (decl)))
return false;
if (TREE_READONLY (decl)
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/49092
+
+struct A
+{
+ A();
+};
+
+int i;
+
+A::A()
+{
+ const int j = i;
+}