aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-01-23 15:45:36 -0500
committerJason Merrill <jason@redhat.com>2020-01-24 12:34:02 -0500
commit28a5d5c365044710ba32510b9bec67dd40562154 (patch)
tree0f1d332f9ea3b9b71905c754e94626b25ff471aa /gcc/cp
parent6ad405c430f40424a53fc93e5ea12b91453e1daf (diff)
downloadgcc-28a5d5c365044710ba32510b9bec67dd40562154.zip
gcc-28a5d5c365044710ba32510b9bec67dd40562154.tar.gz
gcc-28a5d5c365044710ba32510b9bec67dd40562154.tar.bz2
c++: Unshare expressions from constexpr cache.
Another place we need to unshare cached expressions. PR c++/92852 - ICE with generic lambda and reference var. * constexpr.c (maybe_constant_value): Likewise.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/constexpr.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c01bece..b1c9e2c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/92852 - ICE with generic lambda and reference var.
+ * constexpr.c (maybe_constant_value): Likewise.
+
2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/92804
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index f6b8f33..8e880634 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -6598,7 +6598,7 @@ maybe_constant_value (tree t, tree decl, bool manifestly_const_eval)
if (cv_cache == NULL)
cv_cache = hash_map<tree, tree>::create_ggc (101);
if (tree *cached = cv_cache->get (t))
- return *cached;
+ return unshare_expr_without_location (*cached);
r = cxx_eval_outermost_constant_expr (t, true, true, false, false, decl);
gcc_checking_assert (r == t