aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-20 14:05:59 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-20 14:05:59 -0400
commitf5f035a336a9a47d326e800e97fe7fbbeede4a99 (patch)
tree57dc575ed6e98070735858f9393dc04e43a788b4 /gcc/cp/cvt.c
parent91d014fffae1fcf1eb750d40e622e5b80cd1a4ec (diff)
downloadgcc-f5f035a336a9a47d326e800e97fe7fbbeede4a99.zip
gcc-f5f035a336a9a47d326e800e97fe7fbbeede4a99.tar.gz
gcc-f5f035a336a9a47d326e800e97fe7fbbeede4a99.tar.bz2
PR c++/84978, ICE with NRVO.
* cvt.c (cp_get_fndecl_from_callee): Add fold parameter. (cp_get_callee_fndecl_nofold): New. * cp-gimplify.c (cp_genericize_r): Use it instead. * call.c (check_self_delegation): Likewise. From-SVN: r258689
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 40e7576..9b53fa3 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -941,7 +941,7 @@ cp_get_callee (tree call)
if we can. */
tree
-cp_get_fndecl_from_callee (tree fn)
+cp_get_fndecl_from_callee (tree fn, bool fold /* = true */)
{
if (fn == NULL_TREE)
return fn;
@@ -951,7 +951,8 @@ cp_get_fndecl_from_callee (tree fn)
if (type == unknown_type_node)
return NULL_TREE;
gcc_assert (POINTER_TYPE_P (type));
- fn = maybe_constant_init (fn);
+ if (fold)
+ fn = maybe_constant_init (fn);
STRIP_NOPS (fn);
if (TREE_CODE (fn) == ADDR_EXPR)
{
@@ -971,6 +972,14 @@ cp_get_callee_fndecl (tree call)
return cp_get_fndecl_from_callee (cp_get_callee (call));
}
+/* As above, but not using the constexpr machinery. */
+
+tree
+cp_get_callee_fndecl_nofold (tree call)
+{
+ return cp_get_fndecl_from_callee (cp_get_callee (call), false);
+}
+
/* Subroutine of convert_to_void. Warn if we're discarding something with
attribute [[nodiscard]]. */