Yes, it is a wrong, I just want to say they will end after that line
to be precise:
} // float b ends there, then int a ends there

发件人: Std-Proposals <std-proposals-bounces@lists.isocpp.org> 代表 Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org>
发送时间: 2025年12月12日 22:51
收件人: std-proposals@lists.isocpp.org <std-proposals@lists.isocpp.org>
抄送: Sebastian Wittmeier <wittmeier@projectalpha.org>
主题: Re: [std-proposals] 回复: 回复: [PXXXXR0] Add a New Keyword ‘undecl’
 

} // int a and float b ends there

they not just end at the same time, but in reverse order of starting the lifetime.

 

You can do

 

std::string s{"xyz"};

std::string_view v{s};

 

First the string_view is destructed, then the string. As if there would be an outer and an inner block. They are not destructed at the same time.

 

 

-----Ursprüngliche Nachricht-----
Von: SD SH via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Fr 12.12.2025 15:54
Betreff: [std-proposals] 回复: 回复: [PXXXXR0] Add a New Keyword ‘undecl’
An: std-proposals@lists.isocpp.org;
CC: SD SH <Z5515zwy@outlook.com>;

Thanks for your dicussion

in your example,
{
    int a; // int a starts there
    float b;  // float b starts there
} // int a and float b ends there
{
    int a; // int a starts there
    { // scope A
        float b; // float b starts there
        using b = const; // OK, it covers the lifeline of 'b'
        using a = const; // OK, it just make 'a' be const // it is allowed but I didn't mentioned above
        using a = float { a }; // error, because float a is starts in scope A and the const int a couldn't end there
    } // float b ends there; if "using a = float { a };" is allowed, both of the lifeline of const int a and float a will end there, but actually it is unexcepted
    using a = float { a }; // int a ends there and float a starts there
} // float a ends there