From: Marek Polacek Date: Mon, 14 Jan 2019 22:01:24 +0000 (+0000) Subject: PR c++/88825 - ICE with bogus function return type deduction. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f80aa3999d14e23d8e9cd81719b476c2e64116a0;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c1a02f025e..a99ddb5313d 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 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 88e2cd6ab9b..fc61991de35 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 13bb87208a0..20c212c267a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-14 Marek Polacek + + PR c++/88825 - ICE with bogus function return type deduction. + * g++.dg/cpp1y/auto-fn55.C: New test. + 2019-01-14 Jakub Jelinek * 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 00000000000..aea2740e1f5 --- /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" } +}