You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the **/Zc:rvalueCast** option is specified, the compiler correctly identifies an rvalue reference type as the result of a cast operation in accordance with the C++11 standard. When the option is not specified, the compiler behavior is the same as in Visual Studio 2012.
10
+
When the **`/Zc:rvalueCast`** option is specified, the compiler correctly identifies an rvalue reference type as the result of a cast operation. Its behavior conforms to the C++11 standard. When the option is unspecified, the compiler behavior is the same as in Visual Studio 2012.
11
11
12
12
## Syntax
13
13
14
-
> **/Zc:rvalueCast**[**-**]
14
+
> **`/Zc:rvalueCast`**\
15
+
> **`/Zc:rvalueCast-`**
15
16
16
17
## Remarks
17
18
18
-
If **/Zc:rvalueCast** is specified, the compiler follows section 5.4 of the C++11 standard and treats only cast expressions that result in non-reference types and cast expressions that result in rvalue references to non-function types as rvalue types. By default, or if **/Zc:rvalueCast-** is specified, the compiler is non-conformant and treats all cast expressions that result in rvalue references as rvalues. For conformance and to eliminate errors in the use of casts, we recommend that you use **/Zc:rvalueCast**.
19
+
If **`/Zc:rvalueCast`** is specified, the compiler follows section 5.4 of the C++11 standard and treats only cast expressions that result in non-reference types and cast expressions that result in rvalue references to non-function types as rvalue types. By default, or if **`/Zc:rvalueCast-`** is specified, the compiler is non-conforming, and treats all cast expressions that result in rvalue references as rvalues. For conformance, and to eliminate errors in the use of casts, we recommend that you use **`/Zc:rvalueCast`**.
19
20
20
-
By default, **/Zc:rvalueCast** is off (**/Zc:rvalueCast-**). The [/permissive-](permissive-standards-conformance.md) compiler option implicitly sets this option, but it can be overridden by using **/Zc:rvalueCast-**.
21
+
By default, **`/Zc:rvalueCast`** is off (**`/Zc:rvalueCast-`**). The [/permissive-](permissive-standards-conformance.md) compiler option implicitly sets this option, but it can be overridden by using **`/Zc:rvalueCast-`**.
21
22
22
-
Use **/Zc:rvalueCast** if you pass a cast expression as an argument to a function that takes an rvalue reference type. The default behavior causes compiler error [C2664](../../error-messages/compiler-errors-2/compiler-error-c2664.md) when the compiler incorrectly determines the type of the cast expression. This example shows a compiler error in correct code when **/Zc:rvalueCast**is not specified:
23
+
Use **`/Zc:rvalueCast`** if you pass a cast expression as an argument to a function that takes an rvalue reference type. The default behavior causes compiler error [C2664](../../error-messages/compiler-errors-2/compiler-error-c2664.md) when the compiler incorrectly determines the type of the cast expression. This example shows a compiler error in correct code when **`/Zc:rvalueCast`**isn't specified:
23
24
24
25
```cpp
25
26
// Test of /Zc:rvalueCast
@@ -57,7 +58,7 @@ struct Test1 {
57
58
};
58
59
```
59
60
60
-
The default compiler behavior may not report error C2102 when appropriate. In this example, the compiler does not report an error if the address of an rvalue created by an identity cast is taken when **/Zc:rvalueCast** is not specified:
61
+
The default compiler behavior may not report error C2102 when appropriate. In this example, the compiler doesn't report an error if the address of an rvalue created by an identity cast is taken when **`/Zc:rvalueCast`** is unspecified:
61
62
62
63
```cpp
63
64
int main() {
@@ -74,10 +75,10 @@ For more information about conformance issues in Visual C++, see [Nonstandard Be
74
75
75
76
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
0 commit comments