Skip to content

Commit c819b4b

Browse files
author
Colin Robertson
committed
more wordsmithy
1 parent 10169a0 commit c819b4b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/build/reference/zc-twophase.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The **/Zc:twoPhase-** option, under **/permissive-**, tells the compiler to use
1717

1818
Visual Studio 2017 version 15.3 and later: Under [/permissive-](permissive-standards-conformance.md), the compiler uses two-phase name lookup for template name resolution. If you also specify **/Zc:twoPhase-**, the compiler reverts to its previous non-conforming class template and function template name resolution and substitution behavior. When **/permissive-** isn't specified, the non-conforming behavior is the default.
1919

20-
The Windows SDK header files in version 10.0.15063.0 (Creators Update or Redstone 2) and earlier versions don't work correctly in conformance mode. **/Zc:twoPhase-** is required to compile code for those SDK versions when you use **/permissive-** in Visual Studio 2017 version 15.3 and later versions. Versions of the Windows SDK starting with version 10.0.15254.0 (Redstone 3 or Fall Creators Update) work correctly in conformance mode and don't require the **/Zc:twoPhase-** option.
20+
The Windows SDK header files in version 10.0.15063.0 (Creators Update or RS2) and earlier don't work in conformance mode. **/Zc:twoPhase-** is required to compile code for those SDK versions when you use **/permissive-**. Versions of the Windows SDK starting with version 10.0.15254.0 (Fall Creators Update or RS3) work correctly in conformance mode. They don't require the **/Zc:twoPhase-** option.
2121

2222
Use **/Zc:twoPhase-** if your code requires the old behavior to compile correctly. Strongly consider updating your code to conform to the standard.
2323

@@ -37,7 +37,7 @@ By default, or in Visual Studio 2017 version 15.3 and later when you specify bot
3737
3838
As a result, if the template body has syntax errors, but the template never gets instantiated, the compiler doesn't diagnose the errors.
3939
40-
Another effect of this behavior is in overload resolution. Non-standard side-effects occur because of the way the token stream is expanded at the site of instantiation. Symbols that weren't visible at the template declaration may be visible at the point of instantiation, and participate in overload resolution. You may find templates change behavior based on code that wasn't visible at template definition, contrary to the standard.
40+
Another effect of this behavior is in overload resolution. Non-standard behavior occurs because of the way the token stream is expanded at the site of instantiation. Symbols that weren't visible at the template declaration may be visible at the point of instantiation. That means they can participate in overload resolution. You may find templates change behavior based on code that wasn't visible at template definition, contrary to the standard.
4141
4242
For example, consider this code:
4343
@@ -65,6 +65,8 @@ int main()
6565
}
6666
```
6767

68+
Here's the output when you use the default mode, conformance mode, and conformance mode with **/Zc:twoPhase-** compiler options:
69+
6870
```cmd
6971
C:\Temp>cl /EHsc /nologo /W4 zctwophase.cpp && zctwophase
7072
zctwophase.cpp
@@ -79,13 +81,11 @@ zctwophase.cpp
7981
Microsoft one-phase
8082
```
8183

82-
When compiled in conformance mode under **/permissive-**, this program prints "`Standard two-phase`", because the second overload of `func` isn't visible when the compiler encounters the template. If you add **/Zc:twoPhase-**, the program prints "`Microsoft one-phase`". The output is the same as when you don't specify **/permissive-**.
83-
84-
*Dependent names* are names that depend on a template parameter. These names have lookup behavior that is also different under **/Zc:twoPhase-**.
84+
When compiled in conformance mode under **/permissive-**, this program prints "`Standard two-phase`", because the second overload of `func` isn't visible when the compiler reaches the template. If you add **/Zc:twoPhase-**, the program prints "`Microsoft one-phase`". The output is the same as when you don't specify **/permissive-**.
8585

86-
In conformance mode, dependent names aren't bound at the point of the template's definition. Instead, the compiler looks them up when it instantiates the template. For function calls with a dependent function name, the name binds to functions visible at the call site in the template's definition. Additional overloads from argument-dependent lookup are added, both at the point of the template definition, and at the point of template instantiation.
86+
*Dependent names* are names that depend on a template parameter. These names have lookup behavior that is also different under **/Zc:twoPhase-**. In conformance mode, dependent names aren't bound at the point of the template's definition. Instead, the compiler looks them up when it instantiates the template. For function calls with a dependent function name, the name gets bound to functions visible at the call site in the template definition. Additional overloads from argument-dependent lookup are added, both at the point of the template definition, and at the point of template instantiation.
8787

88-
Two-phase lookup consists of the lookup for non-dependent names during template definition, and the lookup for dependent names during template instantiation. Under **/Zc:twoPhase-**, the compiler doesn't do argument-dependent lookup separately from ordinary, unqualified lookup. That is, it doesn't do two-phase lookup, so the results of overload resolution may be different.
88+
Two-phase lookup consists of two parts: The lookup for non-dependent names during template definition, and the lookup for dependent names during template instantiation. Under **/Zc:twoPhase-**, the compiler doesn't do argument-dependent lookup separately from unqualified lookup. That is, it doesn't do two-phase lookup, so the results of overload resolution may be different.
8989

9090
Here's another example:
9191

0 commit comments

Comments
 (0)