Skip to content

Commit bfca6d3

Browse files
Merge pull request MicrosoftDocs#5154 from MicrosoftDocs/main638727354747955228sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents e081295 + 9fb8b51 commit bfca6d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/build/reference/zc-static-assert.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: /Zc:static_assert (Strict static_assert handling)"
33
title: "/Zc:static_assert (Strict static_assert handling)"
4-
ms.date: 12/15/2021
4+
ms.date: 1/15/2025
55
f1_keywords: ["/Zc:static_assert"]
66
helpviewer_keywords: ["/Zc:static_assert compiler option (C++)"]
77
---
@@ -16,7 +16,9 @@ The **`/Zc:static_assert`** compiler option tells the compiler to evaluate `stat
1616
1717
## Remarks
1818

19-
The **`/Zc:static_assert`** compiler option tells the compiler to evaluate a `static_assert` in the body of a function template or in the body of a class template member function when first parsed, if the test expression isn't dependent. If the non-dependent test expression isn't `false`, the compiler emits an error immediately. When the test expression is dependent, the `static_assert` isn't evaluated until the template is instantiated.
19+
Starting with Visual Studio 17.10, `/Zc:static_assert` and `/Zc:static_assert-` have no effect. Both options are ignored to avoid breaking builds that use them. `static_assert` is now never evaluated when parsing class or function templates.
20+
21+
The **`/Zc:static_assert`** compiler option tells the compiler to evaluate a `static_assert` in the body of a function template or in the body of a class template member function when first parsed, if the test expression isn't dependent. If the non-dependent test expression is `false`, the compiler emits an error immediately. When the test expression is dependent, the `static_assert` isn't evaluated until the template is instantiated.
2022

2123
The **`/Zc:static_assert`** option is available starting in Visual Studio 2022 version 17.1. In earlier versions of Visual Studio, or if **`/Zc:static_assert-`** is specified, Visual Studio doesn't do dependent analysis if the `static_assert` is within the body of a function template or within the body of a member function of a class template. Instead, it only evaluates the `static_assert` when a template is instantiated.
2224

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy