aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-02-05 22:33:55 -0500
committerJason Merrill <jason@gcc.gnu.org>2013-02-05 22:33:55 -0500
commita283c407619b032551995bec2a0732ea094a834c (patch)
tree3d89be0fc5977ae10c20d3a849ac503d5970e7a6
parent29ef6cd035bda26987bd4a69a91b66908654b01b (diff)
downloadgcc-a283c407619b032551995bec2a0732ea094a834c.zip
gcc-a283c407619b032551995bec2a0732ea094a834c.tar.gz
gcc-a283c407619b032551995bec2a0732ea094a834c.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c1
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/auto-fn14.C5
3 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ce0bfad..a2bd701 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2013-02-05 Jason Merrill <jason@redhat.com>
+ 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 9b40018..cfee0f8 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 0000000..e7e8699
--- /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; }