summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-18 01:30:21 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-18 01:30:21 +0000
commit5d9aceb4bd4967530683670528d8901548fdb3d9 (patch)
treef67d15a4acadbe8dd4f5b037b12332113cde3ed5 /gcc
parentc27b7f40c9b4fb569570c1e334a2dd5ca8ea6c87 (diff)
downloadppe42-gcc-5d9aceb4bd4967530683670528d8901548fdb3d9.tar.gz
ppe42-gcc-5d9aceb4bd4967530683670528d8901548fdb3d9.zip
* decl2.c (grokfield): Issue error on illegal data member
declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33220 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/crash17.C6
3 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index da6fca8546a..5f3c8fb7aa5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-17 Mark Mitchell <mark@codesourcery.com>
+
+ * decl2.c (grokfield): Issue error on illegal data member
+ declaration.
+
Mon Apr 17 17:11:16 2000 Mark P Mitchell <mark@codesourcery.com>
* method.c (make_thunk): Set DECL_CONTEXT for a THUNK_DECL.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 18d41aa9776..e9b1b1fb4a8 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1572,7 +1572,23 @@ grokfield (declarator, declspecs, init, asmspec_tree, attrlist)
|| TREE_CODE (TREE_OPERAND (declarator, 0)) == SCOPE_REF)
&& parmlist_is_exprlist (CALL_DECLARATOR_PARMS (declarator)))
{
- init = TREE_OPERAND (declarator, 1);
+ /* It's invalid to try to initialize a data member using a
+ functional notation, e.g.:
+
+ struct S {
+ static int i (3);
+ };
+
+ Explain that to the user. */
+ static int explained_p;
+
+ cp_error ("invalid data member initiailization");
+ if (!explained_p)
+ {
+ cp_error ("use `=' to initialize static data members");
+ explained_p = 1;
+ }
+
declarator = TREE_OPERAND (declarator, 0);
flags = 0;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash17.C b/gcc/testsuite/g++.old-deja/g++.other/crash17.C
new file mode 100644
index 00000000000..0ec1d23ba3a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/crash17.C
@@ -0,0 +1,6 @@
+// Build don't link:
+// Origin: Dima Volodin <dvv@dvv.org>
+
+class C {
+ static int const N (1000);
+};
OpenPOWER on IntegriCloud