Skip to content

Commit 43f4eda

Browse files
Merge pull request #4765 from MicrosoftDocs/main638328169016646486sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents ae18e79 + 47b1805 commit 43f4eda

File tree

3 files changed

+72
-58
lines changed

3 files changed

+72
-58
lines changed

docs/build/reference/permissive-standards-conformance.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
title: "/permissive- (Standards conformance)"
33
description: "Reference guide to the Microsoft C++ /permissive- (Standards conformance) compiler option."
4-
ms.date: 12/14/2022
4+
ms.date: 10/12/2023
55
f1_keywords: ["/permissive", "VC.Project.VCCLCompilerTool.ConformanceMode"]
66
helpviewer_keywords: ["/permissive compiler options [C++]", "-permissive compiler options [C++]", "Standards conformance compiler options", "permissive compiler options [C++]"]
7-
ms.assetid: db1cc175-6e93-4a2e-9396-c3725d2d8f71
87
---
98
# `/permissive-` (Standards conformance)
109

@@ -33,6 +32,8 @@ The **`/permissive-`** option sets the [`/Zc:referenceBinding`](zc-referencebind
3332

3433
In versions of the compiler beginning in Visual Studio 2017 version 15.3, the **`/permissive-`** option sets the [`/Zc:ternary`](zc-ternary.md) option. The compiler also implements more of the requirements for two-phase name look-up. When the **`/permissive-`** option is set, the compiler parses function and class template definitions, and identifies dependent and non-dependent names used in the templates. In this release, only name dependency analysis is performed.
3534

35+
As of Visual Studio 2022 Update 17.6, the **`/permissive-`** option sets the [`/Zc:lambda`](zc-lambda.md) and [`/Zc:externConstexpr`](zc-externconstexpr.md) options. In prior versions, **`/permissive-`** didn't set either one.
36+
3637
Environment-specific extensions and language areas that the standard leaves up to the implementation aren't affected by **`/permissive-`**. For example, the Microsoft-specific **`__declspec`**, calling convention and structured exception handling keywords, and compiler-specific `pragma` directives or attributes aren't flagged by the compiler in **`/permissive-`** mode.
3738

3839
The MSVC compiler in earlier versions of Visual Studio 2017 doesn't support all C++11, C++14, or C++17 standards-conforming code. Depending on the version of Visual Studio, the **`/permissive-`** option may not detect issues in some aspects of two-phase name lookup, binding a non-const reference to a temporary, treating copy init as direct init, allowing multiple user-defined conversions in initialization, or alternative tokens for logical operators, and other non-supported conformance areas. For more information about conformance issues in Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md). To get the most out of **`/permissive-`**, update Visual Studio to the latest version.

docs/build/reference/zc-externconstexpr.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
description: "Learn more about: `/Zc:externConstexpr` (Enable extern constexpr variables)"
33
title: "/Zc:externConstexpr (Enable extern constexpr variables)"
4-
ms.date: "02/28/2018"
4+
ms.date: 10/12/2023
55
f1_keywords: ["/Zc:externConstexpr"]
66
helpviewer_keywords: ["-Zc:externConstexpr compiler option (C++)", "extern constexpr variables (C++)"]
7-
ms.assetid: 4da5e33a-2e4d-4ed2-8616-bd8f43265c27
87
---
98
# `/Zc:externConstexpr` (Enable extern constexpr variables)
109

@@ -16,9 +15,13 @@ The **`/Zc:externConstexpr`** compiler option tells the compiler to conform to t
1615
1716
## Remarks
1817

19-
The **`/Zc:externConstexpr`** compiler option causes the compiler to apply external linkage to variables declared by using `extern constexpr`. In earlier versions of Visual Studio, and by default or if **`/Zc:externConstexpr-`** is specified, Visual Studio applies internal linkage to **`constexpr`** variables even if the **`extern`** keyword is used. The **`/Zc:externConstexpr`** option is available starting in Visual Studio 2017 Update 15.6. and is off by default. The [`/permissive-`](permissive-standards-conformance.md) option does not enable **`/Zc:externConstexpr`**.
18+
The **`/Zc:externConstexpr`** compiler option causes the compiler to apply external linkage to variables declared by using `extern constexpr`.
2019

21-
If a header file contains a variable declared `extern constexpr`, it must be marked [`__declspec(selectany)`](../../cpp/selectany.md) in order to merge the duplicate declarations into a single instance in the linked binary. Otherwise you may see linker errors, for example, LNK2005, for violations of the one-definition rule.
20+
In earlier versions of Visual Studio, by default or if **`/Zc:externConstexpr-`** is specified, Visual Studio applies internal linkage to **`constexpr`** variables even if the **`extern`** keyword is used. The **`/Zc:externConstexpr`** option is available starting in Visual Studio 2017 Update 15.6. and is off by default.
21+
22+
As of Visual Studio 2022 Update 17.6, the **`/permissive-`** option enables both **`/Zc:externConstexpr`** and [`/Zc:lambda`](zc-lambda.md). In prior versions, **`/permissive-`** didn't enable either one.
23+
24+
If a header file contains a variable declared **`extern constexpr`**, it must be marked [`__declspec(selectany)`](../../cpp/selectany.md) in order to merge the duplicate declarations into a single instance in the linked binary. Otherwise you may see linker errors, for example, LNK2005, for violations of the one-definition rule.
2225

2326
### To set this compiler option in Visual Studio
2427

@@ -30,5 +33,6 @@ If a header file contains a variable declared `extern constexpr`, it must be mar
3033

3134
## See also
3235

33-
[`/Zc` (Conformance)](zc-conformance.md)<br/>
34-
[`auto` Keyword](../../cpp/auto-cpp.md)
36+
[`auto` Keyword](../../cpp/auto-cpp.md)\
37+
[`permissive`](permissive-standards-conformance.md)\
38+
[`/Zc` (Conformance)](zc-conformance.md)

0 commit comments

Comments
 (0)