On 10/29/20 11:40 AM, Jakub Jelinek wrote:
On Thu, Oct 29, 2020 at 11:09:05AM -0400, Jason Merrill wrote:
I think this isn't enough; if bar calls foo twice, the second call will find
the value in the hash table and not change the temporary, so the destructor
will throw. I think we also need to set non_constant_args if the argument
type has a non-trivial destructor, so we don't try to memoize the call.
For the testcases with constexpr new in there it wouldn't be memoized
already, but you are right that for other cases making it non_constant_args
is desirable.
Then setting arg back to orig_arg isn't needed, because we don't do the
first unsharing for the hash table.
Yes.
And then I think that the second unsharing is unnecessary for an argument in
a non-memoized call, because we will have already unshared it when making
the copy in the caller.
I'm not sure about this one, but if it works, I'm not against that, the less
unsharing the better for compile time memory unless it breaks stuff.
I'll bootstrap/regtest your patchset (or do you want to do that)?
I already did, thanks.
Jason