Информация об изменениях

Сообщение Re: Reference binding in C++23 - bug of gcc? от 01.02.2025 11:10

Изменено 01.02.2025 11:27 rg45

Re: Reference binding in C++23 - bug of gcc?
R>А теперь, внимание, вопрос: что это за хрень?

Резюме.

Собственно, главное изменение вот (выделено):

https://timsong-cpp.github.io/cppwp/expr.prim.id.unqual#3

The expression is an xvalue if it is move-eligible (see below); an lvalue if the entity is a function, variable, structured binding, data member, or template parameter object; and a prvalue otherwise ([basic.lval]); it is a bit-field if the identifier designates a bit-field.


"Move-eligible" — новый термин, который является синонимом ранее существовавшего термина "implicitly movable entity". В С++23 они просто перетащили это определение из "Copy/move elision" в "Expressions":

https://timsong-cpp.github.io/cppwp/expr.prim.id.unqual#4

An implicitly movable entity is a variable of automatic storage duration that is either a non-volatile object or an rvalue reference to a non-volatile object type.
In the following contexts, an id-expression is move-eligible:

  • (4.1) If the id-expression (possibly parenthesized) is the operand of a return ([stmt.return]) or co_return ([stmt.return.coroutine]) statement, and names an implicitly movable entity declared in the body or parameter-declaration-clause of the innermost enclosing function or lambda-expression, or
  • (4.2) if the id-expression (possibly parenthesized) is the operand of a throw-expression ([expr.throw]), and names an implicitly movable entity that belongs to a scope that does not contain the compound-statement of the innermost lambda-expression, try-block, or function-try-block (if any) whose compound-statement or ctor-initializer contains the throw-expression.


Так что, гцц опять молодец
Re: Reference binding in C++23 - bug of gcc?
R>А теперь, внимание, вопрос: что это за хрень?

Резюме.

Главное изменение вот (выделено):

https://timsong-cpp.github.io/cppwp/expr.prim.id.unqual#3

The expression is an xvalue if it is move-eligible (see below); an lvalue if the entity is a function, variable, structured binding, data member, or template parameter object; and a prvalue otherwise ([basic.lval]); it is a bit-field if the identifier designates a bit-field.


"Move-eligible" — новый термин, который является синонимом ранее существовавшего термина "implicitly movable entity". В С++23 они просто перетащили это определение из "Copy/move elision" в "Expressions":

https://timsong-cpp.github.io/cppwp/expr.prim.id.unqual#4

An implicitly movable entity is a variable of automatic storage duration that is either a non-volatile object or an rvalue reference to a non-volatile object type.
In the following contexts, an id-expression is move-eligible:

  • (4.1) If the id-expression (possibly parenthesized) is the operand of a return ([stmt.return]) or co_return ([stmt.return.coroutine]) statement, and names an implicitly movable entity declared in the body or parameter-declaration-clause of the innermost enclosing function or lambda-expression, or
  • (4.2) if the id-expression (possibly parenthesized) is the operand of a throw-expression ([expr.throw]), and names an implicitly movable entity that belongs to a scope that does not contain the compound-statement of the innermost lambda-expression, try-block, or function-try-block (if any) whose compound-statement or ctor-initializer contains the throw-expression.


Так что, гцц опять молодец