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