C++ Logo

std-proposals

Advanced search

Re: [std-proposals] return value lives until end of scope

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 27 May 2026 07:01:04 +0000
On Tuesday, May 26, 2026, Sebastian Wittmeier wrote:

> Syntaxwise:
>
>
>
> if instead of
>
>
>
> _ = for scope-bound anonymous variables
>
>
>
> you use
>
>
>
> % = for function-bound anonymous variables?
>


Perhaps the unary % could be used in variable definitions too:

mutex m;

int main(void)
{
    {
        %lock_guard mylock(m);
    }
}

which would be compiled to:

mutex m;

int main(void)
{
    {
        __builtin_classalloca(lock_guard<mutex>, m);
    }
}

But for the time being I'm going to focus on implementing
'__builtin_classalloca' which will have two forms as follows:

    __builtin_classalloca(typename, args...)
    __builtin_classalloca(callable, args...)

The former calls the constructor with arguments. The latter invokes the
callable with arguments.

Once I have that working I'll see about %.

Received on 2026-05-27 07:01:08