aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-01-16 18:05:39 -0500
committerJason Merrill <jason@gcc.gnu.org>2018-01-16 18:05:39 -0500
commit035181c3129648328176cbdee69d2a7a66e0a895 (patch)
tree52222d646004e51cbef2853abbca932c13a1bbd8 /gcc/cp
parenta9db08a673d3088d8e60663e2b9643e8ad41b1cf (diff)
downloadgcc-035181c3129648328176cbdee69d2a7a66e0a895.zip
gcc-035181c3129648328176cbdee69d2a7a66e0a895.tar.gz
gcc-035181c3129648328176cbdee69d2a7a66e0a895.tar.bz2
PR c++/83714 - ICE checking return in template.
* typeck.c (check_return_expr): Call build_non_dependent_expr. From-SVN: r256765
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a0119e1..d378cb2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-16 Jason Merrill <jason@redhat.com>
+
+ PR c++/83714 - ICE checking return in template.
+ * typeck.c (check_return_expr): Call build_non_dependent_expr.
+
2018-01-16 Jakub Jelinek <jakub@redhat.com>
PR c++/83817
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index f0dc03d..d0adb79 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -9333,6 +9333,9 @@ check_return_expr (tree retval, bool *no_warning)
to undo it so we can try to treat it as an rvalue below. */
retval = maybe_undo_parenthesized_ref (retval);
+ if (processing_template_decl)
+ retval = build_non_dependent_expr (retval);
+
/* Under C++11 [12.8/32 class.copy], a returned lvalue is sometimes
treated as an rvalue for the purposes of overload resolution to
favor move constructors over copy constructors.