PR c++/26573
authorlmillward <lmillward@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Aug 2006 15:22:05 +0000 (15:22 +0000)
committerlmillward <lmillward@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Aug 2006 15:22:05 +0000 (15:22 +0000)
        * class.c (check_field_decls): Don't issue error about
        local classes containing static data members.

        * g++.dg/other/static2.C: New test.

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

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/static2.C [new file with mode: 0644]

index 5c8b1cb..dd1df56 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-27  Lee Millward  <lee.millward@codesourcery.com>
+
+        PR c++/26573
+        * class.c (check_field_decls): Don't issue error about
+        local classes containing static data members.
+       
 2006-08-26  Joseph S. Myers  <joseph@codesourcery.com>
 
        PR c++/24009
index 673b07f..18996a0 100644 (file)
@@ -2856,10 +2856,6 @@ check_field_decls (tree t, tree *access_decls,
            }
        }
 
-      /* ``A local class cannot have static data members.'' ARM 9.4 */
-      if (current_function_decl && TREE_STATIC (x))
-       error ("field %q+D in local class cannot be static", x);
-
       /* Perform error checking that did not get done in
         grokdeclarator.  */
       if (TREE_CODE (type) == FUNCTION_TYPE)
index c6a3dc3..c6d6457 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-27  Lee Millward  <lee.millward@codesourcery.com>
+
+        PR c++/26573
+        * g++.dg/other/static2.C: New test. 
+       
 2006-08-26  Roger Sayle  <roger@eyesopen.com>
 
        * gcc.dg/Wswitch-enum-2.c: New test case.
diff --git a/gcc/testsuite/g++.dg/other/static2.C b/gcc/testsuite/g++.dg/other/static2.C
new file mode 100644 (file)
index 0000000..ff1478c
--- /dev/null
@@ -0,0 +1,12 @@
+//PR c++/26573
+
+void foo()
+{
+  struct A { static int i; };   // { dg-error "shall not have" }
+}
+
+template<typename T>
+void bar()
+{
+  struct B { static int j; };   // { dg-error "shall not have" }
+}