OSDN Git Service

PR c++/2739
authorlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Dec 2002 17:01:45 +0000 (17:01 +0000)
committerlerdsuwa <lerdsuwa@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Dec 2002 17:01:45 +0000 (17:01 +0000)
* g++.dg/other/access2.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60605 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/access2.C [new file with mode: 0644]

index 8dc8451..3373f6d 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-29  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/2739
+       * g++.dg/other/access2.C: New test.
+
 2002-12-29  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * g++.dg/other/anon-struct.C: No longer fails
diff --git a/gcc/testsuite/g++.dg/other/access2.C b/gcc/testsuite/g++.dg/other/access2.C
new file mode 100644 (file)
index 0000000..c7dd77a
--- /dev/null
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// Origin: Dirk Mueller <dmuell@gmx.net>
+
+// PR c++/2739
+// Access to base class private static member.
+
+class Base {
+private:
+  static int fooprivate;
+protected:
+  static int fooprotected;
+public:
+  static int foopublic;
+};
+
+class Derived : public Base {
+public:
+  void test();
+};
+
+int Base::fooprivate=42;       // { dg-error "private" }
+int Base::fooprotected=42;
+int Base::foopublic=42;
+
+void Derived::test() {
+  if ( fooprivate );           // { dg-error "context" }
+  if ( fooprotected );
+  if ( foopublic );
+}
+
+int main()
+{
+  Derived d;
+  d.test();
+}