Date: Fri, 12 Dec 2025 15:51:14 +0100
} // 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_at_[hidden]>
Gesendet:Fr 12.12.2025 15:54
Betreff:[std-proposals] 回复: 回复: [PXXXXR0] Add a New Keyword ‘undecl’
An:std-proposals_at_[hidden];
CC:SD SH <Z5515zwy_at_[hidden]>;
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
--------------------------------
Received on 2025-12-12 15:06:00
