aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-14 23:08:24 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-14 23:08:24 -0400
commitb149eb04c87823dc2f0b9f141fbbc149fd21598a (patch)
tree9a613c3cf8b5ba5489411f04e27d1c803a6df8a6 /gcc/cp
parente786e485a7e6dda1c6d0ecf8981edade93d73110 (diff)
downloadgcc-b149eb04c87823dc2f0b9f141fbbc149fd21598a.zip
gcc-b149eb04c87823dc2f0b9f141fbbc149fd21598a.tar.gz
gcc-b149eb04c87823dc2f0b9f141fbbc149fd21598a.tar.bz2
PR c++/81236 - auto variable and auto function
* pt.c (tsubst_baselink): Update the type of the BASELINK after mark_used. From-SVN: r258547
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c13
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a4ffc66..fc124b44 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
2018-03-14 Jason Merrill <jason@redhat.com>
+ PR c++/81236 - auto variable and auto function
+ * pt.c (tsubst_baselink): Update the type of the BASELINK after
+ mark_used.
+
+2018-03-14 Jason Merrill <jason@redhat.com>
+
PR c++/83916 - ICE with template template parameters.
* pt.c (convert_template_argument): Don't substitute into type of
non-type parameter if we don't have enough arg levels.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1432181..2ea5fc7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14700,9 +14700,16 @@ tsubst_baselink (tree baselink, tree object_type,
/* If lookup found a single function, mark it as used at this point.
(If lookup found multiple functions the one selected later by
overload resolution will be marked as used at that point.) */
- if (!template_id_p && !really_overloaded_fn (fns)
- && !mark_used (OVL_FIRST (fns), complain) && !(complain & tf_error))
- return error_mark_node;
+ if (!template_id_p && !really_overloaded_fn (fns))
+ {
+ tree fn = OVL_FIRST (fns);
+ bool ok = mark_used (fn, complain);
+ if (!ok && !(complain & tf_error))
+ return error_mark_node;
+ if (ok && BASELINK_P (baselink))
+ /* We might have instantiated an auto function. */
+ TREE_TYPE (baselink) = TREE_TYPE (fn);
+ }
if (BASELINK_P (baselink))
{