On 2020-09-19 18:07, Per Nordlöw wrote:
If an aggregate member is pure but not scope when can it escape the `this` pointer?.

Only via return?

I'm not sure if returning the `this` pointer is considered escaping it. The caller already had access to it. Under the hood, the `this` pointer is just another argument passed to the function.

In the struct and class case?

A nested class seems to be able to escape the `this` reference:

class Foo
{
    Bar b;

    class Bar
    {
        void bar() pure
        {
            b = this;
        }
    }
}

--
/Jacob Carlborg

Reply via email to