From: mpolacek Date: Mon, 14 Jan 2019 22:01:24 +0000 (+0000) Subject: PR c++/88825 - ICE with bogus function return type deduction. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f8a8956070411d6daa9f4f2ead35d176d9f8556;p=thirdparty%2Fgcc.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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267926 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c1a02f025e2..a99ddb5313dc 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 88e2cd6ab9bc..fc61991de350 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 13bb87208a04..20c212c267aa 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 000000000000..aea2740e1f52 --- /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" } +}