diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/optimize.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr71464.C | 7 |
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6920109..391aa5f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-03-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/71464 + * optimize.c (maybe_thunk_body): Bail out immediately if either + fns[0] or fns[1] is null. + 2018-03-02 Marek Polacek <polacek@redhat.com> PR c++/84578 diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index a1cb610..fdb1650 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -261,8 +261,12 @@ maybe_thunk_body (tree fn, bool force) populate_clone_array (fn, fns); + /* Can happen during error recovery (c++/71464). */ + if (!fns[0] || !fns[1]) + return 0; + /* Don't use thunks if the base clone omits inherited parameters. */ - if (fns[0] && ctor_omit_inherited_parms (fns[0])) + if (ctor_omit_inherited_parms (fns[0])) return 0; DECL_ABSTRACT_P (fn) = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a867711..b5b5779 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/71464 + * g++.dg/torture/pr71464.C: New. + 2018-03-03 Paul Thomas <pault@gcc.gnu.org> PR fortran/80965 diff --git a/gcc/testsuite/g++.dg/torture/pr71464.C b/gcc/testsuite/g++.dg/torture/pr71464.C new file mode 100644 index 0000000..0ed7de7 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr71464.C @@ -0,0 +1,7 @@ +struct A {}; + +struct B : virtual A +{ + B () {}; + B () {}; // { dg-error "cannot be overloaded" } +}; |