Files
cppdraft_translate/cppdraft/conv/rval.md
2025-10-25 03:02:53 +03:00

30 lines
1.0 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[conv.rval]
# 7 Expressions [[expr]](./#expr)
## 7.3 Standard conversions [[conv]](conv#rval)
### 7.3.5 Temporary materialization conversion [conv.rval]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L734)
A prvalue of type T can be converted to an xvalue of type T[.](#1.sentence-1)
This conversion initializes a temporary object ([[class.temporary]](class.temporary "6.8.7Temporary objects")) of type T from the prvalue
by evaluating the prvalue with the temporary object as its result object,
and produces an xvalue denoting the temporary object[.](#1.sentence-2)
T shall be a complete type[.](#1.sentence-3)
[*Note [1](#note-1)*:
If T is a class type (or array thereof),
it must have an accessible and non-deleted destructor;
see [[class.dtor]](class.dtor "11.4.7Destructors")[.](#1.sentence-4)
— *end note*]
[*Example [1](#example-1)*: struct X { int n; };int k = X().n; // OK, X() prvalue is converted to xvalue — *end example*]