aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Millward <lee.millward@codesourcery.com>2006-08-27 15:22:05 +0000
committerLee Millward <lee.millward@codesourcery.com>2006-08-27 15:22:05 +0000
commit21c8f74f9dc711c295dab3dd866d25fbf58e0463 (patch)
tree8079c25e8fb391d151cee0b5b49eb214449711dd
parent9aa5f15b380a9a59e1700cb47d1008c13ab406d7 (diff)
PR c++/26573
* 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: https://gcc.gnu.org/svn/gcc/trunk@116490 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/static2.C12
4 files changed, 23 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5c8b1cb1564..dd1df56fca4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 673b07fb3d0..18996a043b8 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c6a3dc35284..c6d64573eae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..ff1478c2a94
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/static2.C
@@ -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" }
+}