From: Jason Merrill Date: Wed, 6 Feb 2013 03:33:55 +0000 (-0500) Subject: re PR c++/56177 (ICE when used forward for 'auto f();') X-Git-Tag: releases/gcc-4.8.0~606 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a283c407619b032551995bec2a0732ea094a834c;p=thirdparty%2Fgcc.git re PR c++/56177 (ICE when used forward for 'auto f();') PR c++/56177 * decl.c (start_preparsed_function): Update restype if we change decl1. From-SVN: r195780 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce0bfad64f7b..a2bd7017ee14 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-02-05 Jason Merrill + PR c++/56177 + * decl.c (start_preparsed_function): Update restype if we change + decl1. + PR c++/56208 * pt.c (fn_type_unification): Discard any access checks from substituting explicit args. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9b40018370fd..cfee0f8d37da 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13116,6 +13116,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) DECL_CONTEXT (decl1) = DECL_CONTEXT (DECL_TI_TEMPLATE (decl1)); } fntype = TREE_TYPE (decl1); + restype = TREE_TYPE (fntype); /* If #pragma weak applies, mark the decl appropriately now. The pragma only applies to global functions. Because diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C new file mode 100644 index 000000000000..e7e86991ed3a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn14.C @@ -0,0 +1,5 @@ +// PR c++/56177 +// { dg-options "-std=c++1y" } + +auto f (); +auto f () { return 33; }