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
This commit is contained in:
Marek Polacek 2019-01-14 22:01:24 +00:00 committed by Marek Polacek
parent a30d019637
commit f80aa3999d
4 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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" }
}