https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112335

--- Comment #5 from Federico Kircheis <federico at kircheis dot it> ---
Ok, the described case would be something like

----
std::unique_ptr<s> t;
__thread bool tt;
inline s::~s()
{
  if (tt)
    return;
  tt = true;
  t.reset(new s);
  tt = false;
}

std::unique_ptr<s> t2;
bar(t, t2);
----


The postcondition of p.reset() is that p == nullptr.

----
void reset(pointer p = pointer()) noexcept;
Preconditions: The expression get_deleter()(get()) is well-formed, has
well-defined behavior, and does not throw exceptions.
Effects: Assigns p to the stored pointer, and then if and only if the old value
of the stored pointer, old_p, was not equal to nullptr, calls
get_deleter()(old_p). [Note: The order of these operations is significant
because the call to get_deleter() may destroy *this. — end note]
Postconditions: get() == p. [Note: The postcondition does not hold if the call
to get_deleter() destroys *this since this->get() is no longer a valid
expression. — end note]
----

I do not think that the case you have in mind is supported by the standard, but
the postcondition does not hold with some deleters, so not sure if that could
be relevant here

Reply via email to