diff options
author | Marek Polacek <polacek@redhat.com> | 2019-01-14 22:01:24 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-01-14 22:01:24 +0000 |
commit | f80aa3999d14e23d8e9cd81719b476c2e64116a0 (patch) | |
tree | a713cec67782324f52dc0e6054470f3f054d9640 | |
parent | a30d0196379064ed2b24c6d405ffeb6b72b9a281 (diff) | |
download | gcc-f80aa3999d14e23d8e9cd81719b476c2e64116a0.zip gcc-f80aa3999d14e23d8e9cd81719b476c2e64116a0.tar.gz gcc-f80aa3999d14e23d8e9cd81719b476c2e64116a0.tar.bz2 |
PR c++/88825 - ICE with bogus function return type deduction.
* typeck.c (can_do_nrvo_p): Check error_mark_node.
* g++.dg/cpp1y/auto-fn55.C: New test.
From-SVN: r267926
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/auto-fn55.C | 8 |
4 files changed, 18 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c1a02f..a99ddb5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -4,6 +4,9 @@ * decl2.c (maybe_emit_vtables): Check CLASSTYPE_LAZY_DESTRUCTOR. Fix formatting. + PR c++/88825 - ICE with bogus function return type deduction. + * typeck.c (can_do_nrvo_p): Check error_mark_node. + 2019-01-14 Tom Honermann <tom@honermann.net> Implement P0482R5, char8_t: A type for UTF-8 characters and strings diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 88e2cd6..fc61991 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -9343,6 +9343,8 @@ is_std_move_p (tree fn) static bool can_do_nrvo_p (tree retval, tree functype) { + if (functype == error_mark_node) + return false; if (retval) STRIP_ANY_LOCATION_WRAPPER (retval); tree result = DECL_RESULT (current_function_decl); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13bb872..20c212c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-14 Marek Polacek <polacek@redhat.com> + + PR c++/88825 - ICE with bogus function return type deduction. + * g++.dg/cpp1y/auto-fn55.C: New test. + 2019-01-14 Jakub Jelinek <jakub@redhat.com> * g++.dg/cpp1z/feat-cxx1z.C: Add tests for diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn55.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn55.C new file mode 100644 index 0000000..aea2740 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn55.C @@ -0,0 +1,8 @@ +// PR c++/88825 +// { dg-do compile { target c++14 } } + +auto f () -> auto * +{ + int t = 0; + return t; // { dg-error "unable to deduce" } +} |