Skip to content

Commit 3a6fd83

Browse files
committed
add note that behavior changed in 17.10
1 parent 848b1e4 commit 3a6fd83

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
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,6 +16,8 @@ The **`/Zc:static_assert`** compiler option tells the compiler to evaluate `stat
1616
1717
## Remarks
1818

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 always evaluated when parsing class or function templates.
20+
1921
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.
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.

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