aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorLee Millward <lee.millward@gmail.com>2006-06-25 11:28:01 +0000
committerLee Millward <lmillward@gcc.gnu.org>2006-06-25 11:28:01 +0000
commit344f237baff9bb9348473bafa10bf19ad6ac3577 (patch)
tree36738e80a4e5cf19ac4932278cedb6521d275f8e /gcc
parent0fdc23b94d00f5c541a71456b0704534f4731ddc (diff)
downloadgcc-344f237baff9bb9348473bafa10bf19ad6ac3577.zip
gcc-344f237baff9bb9348473bafa10bf19ad6ac3577.tar.gz
gcc-344f237baff9bb9348473bafa10bf19ad6ac3577.tar.bz2
re PR c++/28054 (ICE with friend declaration of invalid bitfield)
PR c++/28054 * decl2.c (grokbitfield): Remove check for grokdeclarator returning NULL_TREE, instead check for error_mark_node to indicate failure. * decl.c (grokdeclarator): Adjust block comment. * g++.dg/other/incomplete3.C: New test. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r114986
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/decl2.c3
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/other/incomplete3.C9
5 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dae7f43..e68602f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,4 +1,13 @@
2006-06-25 Lee Millward <lee.millward@gmail.com>
+ Mark Mitchell <mark@codesuorcery.com>
+
+ PR c++/28054
+ * decl2.c (grokbitfied): Remove check for grokdeclarator
+ returning NULL_TREE, instead check for error_mark_node
+ to indicate failure.
+ * decl.c (grokdeclarator): Adjust block comment.
+
+2006-06-25 Lee Millward <lee.millward@gmail.com>
PR c++/28051
* mangle.c (mangle_conv_op_name_for_type): Check for
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index e3c9297..5a630f5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6812,7 +6812,11 @@ check_var_type (tree identifier, tree type)
void S::f() { ... }
when grokdeclarator is called for `S::f', the CURRENT_CLASS_TYPE
- should not be `S'. */
+ should not be `S'.
+
+ Returns a DECL (if a declarator is present), a TYPE (if there is no
+ declarator, in cases like "struct S;"), or the ERROR_MARK_NODE if an
+ error occurs. */
tree
grokdeclarator (const cp_declarator *declarator,
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 49e320c..80fcc29 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -944,7 +944,8 @@ grokbitfield (const cp_declarator *declarator,
{
tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, NULL);
- if (! value) return NULL_TREE; /* friends went bad. */
+ if (value == error_mark_node)
+ return NULL_TREE; /* friends went bad. */
/* Pass friendly classes back. */
if (TREE_CODE (value) == VOID_TYPE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 09a6265..8e66a79 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -2,6 +2,9 @@
PR c++/28051
* g++.dg/template/using13.C: New test.
+
+ PR c++/28054
+ * g++.dg/other/incomplete3.C: New test.
2006-06-24 Francois-Xavier Coudert <coudert@clipper.ens.fr>
diff --git a/gcc/testsuite/g++.dg/other/incomplete3.C b/gcc/testsuite/g++.dg/other/incomplete3.C
new file mode 100644
index 0000000..14de98e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/incomplete3.C
@@ -0,0 +1,9 @@
+//PR c++/28054
+
+struct A;
+
+struct B
+{
+ friend A : 2; // { dg-error "incomplete type" }
+};
+