aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2016-06-04 07:10:58 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2016-06-04 07:10:58 +0000
commit909a11ad43c91acda1b74de1a81a67bf3dbe751d (patch)
tree37289a706dfdb57baeedcfe25a9a8a3bfb1970af
parentc389d3496ad217dbce58cc90c7cc7c7d31b40d81 (diff)
downloadgcc-909a11ad43c91acda1b74de1a81a67bf3dbe751d.zip
gcc-909a11ad43c91acda1b74de1a81a67bf3dbe751d.tar.gz
gcc-909a11ad43c91acda1b74de1a81a67bf3dbe751d.tar.bz2
re PR c++/70202 (ICE on invalid code on x86_64-linux-gnu in build_simple_base_path, at cp/class.c:579)
/cp 2016-06-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70202 * parser.c (cp_parser_class_head): When xref_basetypes fails and emits an error do not zero the type. /testsuite 2016-06-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/70202 * g++.dg/inherit/crash5.C: New. * g++.dg/inherit/virtual1.C: Adjust. From-SVN: r237089
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/inherit/crash5.C10
-rw-r--r--gcc/testsuite/g++.dg/inherit/virtual1.C6
5 files changed, 27 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0569d84..b6c0c98 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/70202
+ * parser.c (cp_parser_class_head): When xref_basetypes fails and
+ emits an error do not zero the type.
+
2016-06-03 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/27100
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index e01353d..2fccc5a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -22050,9 +22050,8 @@ cp_parser_class_head (cp_parser* parser,
/* If we're really defining a class, process the base classes.
If they're invalid, fail. */
- if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)
- && !xref_basetypes (type, bases))
- type = NULL_TREE;
+ if (type && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ xref_basetypes (type, bases);
done:
/* Leave the scope given by the nested-name-specifier. We will
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cd45cda..94b4a33 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/70202
+ * g++.dg/inherit/crash5.C: New.
+ * g++.dg/inherit/virtual1.C: Adjust.
+
2016-06-03 Jeff Law <law@redhat.com>
PR tree-optimization/71316
diff --git a/gcc/testsuite/g++.dg/inherit/crash5.C b/gcc/testsuite/g++.dg/inherit/crash5.C
new file mode 100644
index 0000000..bce999c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/inherit/crash5.C
@@ -0,0 +1,10 @@
+// PR c++/70202
+
+class A
+{
+ virtual void foo () { }
+};
+class B : public A, A { }; // { dg-error "duplicate base type" }
+
+B b1, &b2 = b1;
+A a = b2;
diff --git a/gcc/testsuite/g++.dg/inherit/virtual1.C b/gcc/testsuite/g++.dg/inherit/virtual1.C
index 08bcbb1..1199b81 100644
--- a/gcc/testsuite/g++.dg/inherit/virtual1.C
+++ b/gcc/testsuite/g++.dg/inherit/virtual1.C
@@ -5,8 +5,8 @@ struct A
virtual ~A() {}
};
-struct B : A, virtual A {}; // { dg-error "duplicate base|forward declaration" }
+struct B : A, virtual A {}; // { dg-error "duplicate base" }
-struct C : A, B {}; // { dg-error "duplicate base|invalid use" }
+struct C : A, B {}; // { dg-error "duplicate base" }
-C c; // { dg-error "aggregate" }
+C c;