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

David Stone <david at doublewise dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david at doublewise dot net

--- Comment #1 from David Stone <david at doublewise dot net> ---
This seems like it could be the same issue. The following code should be
rejected, but it's accepted.

```
#include <algorithm>

struct S {
        int * m_ptr;

        constexpr S():
                m_ptr(new int)
        {
        }
        S(const S&) = delete;
        S& operator=(const S&) = delete;
        constexpr ~S() {
                delete m_ptr;
        }
};

constexpr bool test(S v) {
        v.m_ptr = nullptr;
        return true;
}

static_assert(test(S()));
```

Here, we have a memory leak that fails to be reported. It seems like changes to
by-value function parameters are not maintained for the destructor?

Reply via email to