Blame SOURCES/gcc34-pr18925.patch

6fdc0f
2004-12-13  Mark Mitchell  <mark@codesourcery.com>
6fdc0f
6fdc0f
	PR c++/18925
6fdc0f
	* class.c (layout_class_type): Determine the visibility of static
6fdc0f
	data members.
6fdc0f
6fdc0f
	* g++.dg/ext/visibility/staticdatamem.C: New test.
6fdc0f
6fdc0f
--- gcc/cp/class.c	8 Dec 2004 08:35:33 -0000	1.692
6fdc0f
+++ gcc/cp/class.c	14 Dec 2004 02:21:46 -0000	1.693
6fdc0f
@@ -4553,7 +4553,13 @@ layout_class_type (tree t, tree *virtual
6fdc0f
              At this point, finish_record_layout will be called, but
6fdc0f
 	     S1 is still incomplete.)  */
6fdc0f
 	  if (TREE_CODE (field) == VAR_DECL)
6fdc0f
-	    maybe_register_incomplete_var (field);
6fdc0f
+	    {
6fdc0f
+	      maybe_register_incomplete_var (field);
6fdc0f
+	      /* The visibility of static data members is determined
6fdc0f
+		 at their point of declaration, not their point of
6fdc0f
+		 definition.  */
6fdc0f
+	      determine_visibility (field);
6fdc0f
+	    }
6fdc0f
 	  continue;
6fdc0f
 	}
6fdc0f
 
6fdc0f
--- gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C	1 Jan 1970 00:00:00 -0000
6fdc0f
+++ gcc/testsuite/g++.dg/ext/visibility/staticdatamem.C	14 Dec 2004 02:15:55 -0000	1.1
6fdc0f
@@ -0,0 +1,20 @@
6fdc0f
+// PR c++/18925
6fdc0f
+// { dg-do compile { target ia64-*-linux* } }
6fdc0f
+// { dg-options "-fPIC -fvisibility=hidden" }
6fdc0f
+// { dg-final { scan-assembler-not "gprel" } }
6fdc0f
+
6fdc0f
+class __attribute__ ((visibility("default"))) Type 
6fdc0f
+{ 
6fdc0f
+ private: 
6fdc0f
+  static long _staticTypeCount; 
6fdc0f
+ public: 
6fdc0f
+  Type() { _staticTypeCount++; } 
6fdc0f
+  ~Type(); 
6fdc0f
+}; 
6fdc0f
+ 
6fdc0f
+long Type::_staticTypeCount = 0; 
6fdc0f
+ 
6fdc0f
+Type::~Type() 
6fdc0f
+{ 
6fdc0f
+ _staticTypeCount--; 
6fdc0f
+}