+2020-02-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/92852
+ * constexpr.c (maybe_constant_value): Don't unshare if the cached
+ value is the same as the argument.
+
2020-02-14 Jakub Jelinek <jakub@redhat.com>
PR c++/61414
if (cv_cache == NULL)
cv_cache = hash_map<tree, tree>::create_ggc (101);
if (tree *cached = cv_cache->get (t))
- return unshare_expr_without_location (*cached);
+ {
+ r = *cached;
+ if (r != t)
+ {
+ r = unshare_expr_without_location (r);
+ protected_set_expr_location (r, EXPR_LOCATION (t));
+ }
+ return r;
+ }
r = cxx_eval_outermost_constant_expr (t, true, true, false, decl);
gcc_checking_assert (r == t
{
S v {1, 2};
auto& [s, t] = v; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
- return s; // { dg-warning "reference to local variable 'v' returned" }
+ return s; // { dg-warning "reference to local variable 'v' returned" "" { target *-*-* } .-1 }
}
int &
{
int a[3] = {1, 2, 3};
auto& [s, t, u] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
- return s; // { dg-warning "reference to local variable 'a' returned" }
+ return s; // { dg-warning "reference to local variable 'a' returned" "" { target *-*-* } .-1 }
}
int &
{
S v {1, 2};
auto& [s, t] = v; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
- return &s; // { dg-warning "address of local variable 'v' returned" }
+ return &s; // { dg-warning "address of local variable 'v' returned" "" { target *-*-* } .-1 }
}
int *
{
int a[3] = {1, 2, 3};
auto& [s, t, u] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } }
- return &s; // { dg-warning "address of local variable 'a' returned" }
+ return &s; // { dg-warning "address of local variable 'a' returned" "" { target *-*-* } .-1 }
}
int *