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
Copy file name to clipboardExpand all lines: docs/build/reference/compiler-options-listed-alphabetically.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
111
111
|[`/homeparams`](homeparams-copy-register-parameters-to-stack.md)| Forces parameters passed in registers to be written to their locations on the stack upon function entry. This compiler option is only for the x64 compilers (native and cross compile). |
112
112
|[`/hotpatch`](hotpatch-create-hotpatchable-image.md)| Creates a hotpatchable image. |
113
113
|[`/I<dir>`](i-additional-include-directories.md)| Searches a directory for include files. |
114
+
|**`/ifcOutput`**| Specify output file or directory for *`.ifc`* files. |
114
115
|[`/J`](j-default-char-type-is-unsigned.md)| Changes the default **`char`** type. |
115
116
|[`/JMC`](jmc.md)| Supports native C++ Just My Code debugging. |
116
117
|[`/kernel`](kernel-create-kernel-mode-binary.md)| The compiler and linker will create a binary that can be executed in the Windows kernel. |
Copy file name to clipboardExpand all lines: docs/overview/cpp-conformance-improvements.md
+87-1Lines changed: 87 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,93 @@ Microsoft C/C++ in Visual Studio (MSVC) makes conformance improvements and bug f
10
10
11
11
This document lists the changes in Visual Studio 2022. For a guide to the changes in Visual Studio 2019, see [C++ conformance improvements in Visual Studio 2019](cpp-conformance-improvements-2019.md). For changes in Visual Studio 2017, see [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md). For a complete list of previous conformance improvements, see [Visual C++ What's New 2003 through 2015](../porting/visual-cpp-what-s-new-2003-through-2015.md).
12
12
13
-
## <aname="improvements_170_preview"></a> Conformance improvements in Visual Studio 2022 version 17.0
13
+
## <aname="improvements_171"></a> Conformance improvements in Visual Studio 2022 version 17.1
14
+
15
+
Visual Studio 2022 version 17.1 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C++ compiler.
16
+
17
+
### Detect ill-formed capture default in non-local lambda-expressions
18
+
19
+
The C++ Standard only allows a lambda expression in block scope to have a capture-default. In Visual C++ 2022 version 17.1 and later, the compiler now detects when a capture default isn't allowed in a non-local lambda expression and emits a new level 4 warning, C5253.
20
+
21
+
This change is a source breaking change. It applies in any mode that uses the new lambda processor: **`/Zc:lambda`**, **`/std:c++20`**, or **`/std:c++latest`**.
22
+
23
+
#### Example
24
+
25
+
In Visual C++ 2022 version 17.1 this code now emits an error:
26
+
27
+
```cpp
28
+
#pragma warning(error:5253)
29
+
30
+
auto incr = [=](int value) { return value + 1; };
31
+
32
+
// capture_default.cpp(3,14): error C5253: a non-local lambda cannot have a capture default
33
+
// auto incr = [=](int value) { return value + 1; };
34
+
// ^
35
+
```
36
+
37
+
To fix this issue, remove the capture default:
38
+
39
+
```cpp
40
+
#pragma warning(error:5253)
41
+
42
+
auto incr = [](int value) { return value + 1; };
43
+
```
44
+
45
+
### C4028 is now C4133 for function-to-pointer operations
46
+
47
+
Before Visual Studio 2022 version 17.1, the compiler reported an incorrect error message on certain pointer-to-function comparisons in C code. The incorrect message was reported when you compared two function pointers that had the same argument counts but incompatible types. Now, we issue a different warning that complains about pointer-to-function incompatibility rather than function parameter mismatch.
48
+
49
+
This change is a source breaking change. It applies when code is compiled as C.
50
+
51
+
#### Example
52
+
53
+
```C
54
+
intf1(int);
55
+
int f2(char*);
56
+
int main(void)
57
+
{
58
+
return (f1 == f2);
59
+
}
60
+
// Old warning:
61
+
// C4028: formal parameter 1 different from declaration
62
+
// New warning:
63
+
// C4113: 'int (__cdecl *)(char *)' differs in parameter lists from 'int (__cdecl *)(int)'
64
+
```
65
+
66
+
### Error on a non-dependent static_assert
67
+
68
+
In Visual Studio 2022 version 17.1 and later, if the expression associated with a `static_assert` is not dependent, the compiler evaluates the expression as soon as it's parsed. If the expression evaluates to `false`, the compiler emits an error. Previously, if the `static_assert` was within the body of a function template (or within the body of a member function of a class template), the compiler wouldn't perform this analysis.
69
+
70
+
This change is a source breaking change. It applies in any mode that implies **`/Zc:permissive-`** or **`/Zc:static_assert`**. This change in behavior can be disabled by using the **`/Zc:static_assert-`** compiler option.
71
+
72
+
#### Example
73
+
74
+
In Visual Studio 2022 version 17.1 and later, this code now causes an error:
75
+
76
+
```cpp
77
+
template<typename T>
78
+
void f()
79
+
{
80
+
static_assert(false, "BOOM!");
81
+
}
82
+
```
83
+
84
+
To fix this issue, make the expression dependent. For example:
85
+
86
+
```cpp
87
+
template<typename>
88
+
constexprbool dependent_false = false;
89
+
90
+
template<typename T>
91
+
voidf()
92
+
{
93
+
static_assert(dependent_false<T>, "BOOM!");
94
+
}
95
+
```
96
+
97
+
With this change, the compiler only emits an error if the function template `f` is instantiated.
98
+
99
+
## <aname="improvements_170"></a> Conformance improvements in Visual Studio 2022 version 17.0
14
100
15
101
Visual Studio 2022 version 17.0 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C++ compiler.
Copy file name to clipboardExpand all lines: docs/overview/what-s-new-for-visual-cpp-in-visual-studio.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,30 @@
1
1
---
2
2
title: "What's new for C++ in Visual Studio"
3
3
description: "The new features and fixes in the Microsoft C/C++ compiler and tools in Visual Studio."
4
-
ms.date: 11/05/2021
4
+
ms.date: 02/15/2022
5
5
ms.technology: "cpp-ide"
6
6
ms.custom: intro-whats-new
7
7
---
8
8
# What's new for C++ in Visual Studio 2022
9
9
10
10
Visual Studio 2022 brings many updates and fixes to the Microsoft C++ environment. We've added features and fixed many bugs and issues in the compiler and tools. The Visual Studio IDE also offers significant improvements in performance and productivity, and now runs natively as a 64-bit application. For more information on what's new in all of Visual Studio, visit [What's new in Visual Studio 2022](/visualstudio/ide/whats-new-visual-studio-2022?view=vs-2022&preserve-view=true). For information about what's new in the C++ docs, see [Microsoft C++ docs: What's new](whats-new-cpp-docs.md).
11
11
12
+
## What's new for C++ in Visual Studio version 17.1
13
+
14
+
For a summary of new features and bug fixes in Visual Studio, see [What's New in Visual Studio 2022 version 17.1](/visualstudio/releases/2022/release-notes).
15
+
16
+
- A new **Configure Preset** template has been added to configure and build CMake projects on a remote macOS system with *`CMakePresets.json`*. You can also launch CMake targets on a remote macOS system, and then debug remotely in the Visual Studio debugger backed by GDB or LLDB.
17
+
18
+
- You can now debug core dumps on a remote macOS system from Visual Studio with LLDB or GDB.
19
+
20
+
- The versions of [`Clang`](https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html) and [`LLVM`](https://releases.llvm.org/13.0.0/docs/ReleaseNotes.html) shipped with Visual Studio have been upgraded to v13.
21
+
22
+
- Visual Studio's CMake integration is only active when a *`CMakeLists.txt`* is identified at the root of the open workspace. If a *`CMakeLists.txt`* is identified at another level of the workspace, then you'll be prompted to activate Visual Studio's CMake integration with a notification.
23
+
24
+
- Added a new register visualization window for embedded targets, available through **Debug** > **Windows** > **Embedded Registers**.
25
+
26
+
- Added a new thread view for RTOS projects, available through **Debug** > **Windows** > **RTOS Objects**.
27
+
12
28
## What's new for C++ in Visual Studio version 17.0
13
29
14
30
For a summary of new features and bug fixes in Visual Studio, see [What's New in Visual Studio 2022 version 17.0](/visualstudio/releases/2022/release-notes).
@@ -61,14 +77,14 @@ Select Standard Library (STL) improvements are highlighted here. For a comprehen
61
77
-[P1679R3](https://wg21.link/P1679R3)`contains()` For `basic_string` and `basic_string_view`
62
78
-[P1682R3](https://wg21.link/P1682R3)`to_underlying()` for enumerations
63
79
-[P2162R2](https://wg21.link/P2162R2) Allow inheriting from `std::variant`
64
-
-[P2166R1](https://wg21.link/P2166R1) Prohibit constructing`basic_string` and `basic_string_view` from `nullptr`. This is a source-breaking change. Code that previously had undefined behavior at runtime will now be rejected with compiler errors.
65
-
-[P2186R2](https://wg21.link/P2186R2) Removed garbage collection support. This removes `declare_reachable`, `undeclare_reachable`, `declare_no_pointers`, `undeclare_no_pointers`, `get_pointer_safety`. Previously, these functions had no effect.
80
+
-[P2166R1](https://wg21.link/P2166R1) Prohibit constructing`basic_string` and `basic_string_view` from `nullptr`. This change is a source-breaking change. Code that previously had undefined behavior at runtime is now rejected with compiler errors.
81
+
-[P2186R2](https://wg21.link/P2186R2) Removed garbage collection support. This change removes `declare_reachable`, `undeclare_reachable`, `declare_no_pointers`, `undeclare_no_pointers`, `get_pointer_safety`. Previously, these functions had no effect.
66
82
67
83
**Highlighted performance improvements**
68
84
69
85
-`<format>` now detects when it's writing to a `back_insert_iterator` for a `basic_string` or a `vector`, and makes a faster call to `insert()` at the `end()` of the container.
70
-
-Improved the performance of `std::find()` and `std::count()` for `vector<bool>` 19x and 26x (times, not percent).
71
-
-Improved the performance of `std::count()` for `vector<bool>`
86
+
-We improved the performance of `std::find()` and `std::count()` for `vector<bool>` 19x and 26x (times, not percent).
87
+
-We improved the performance of `std::count()` for `vector<bool>`
72
88
-`std::byte` now has the same performance as `unsigned char` in `reverse()` and `variant::swap()`
73
89
74
90
### Clang and LLVM support
@@ -87,7 +103,7 @@ Select Standard Library (STL) improvements are highlighted here. For a comprehen
87
103
88
104
- We made improvements in C++ IntelliSense when providing navigation and syntax highlighting for types from imported Modules and Header Units. IntelliSense is an active area of investment for us. Help us improve: Share your feedback on Developer Community by using **Help** > **Send Feedback**.
89
105
90
-
-Improved C++ IntelliSense performance by optimizing cached header usage and symbol database access, providing improved load times to get into your code.
106
+
-We improved C++ IntelliSense performance by optimizing cached header usage and symbol database access, providing improved load times to get into your code.
91
107
92
108
- The IntelliSense Code Linter for C++ is now on by default, providing instant as-you-type suggestions and fix suggestions for common code defects.
93
109
@@ -117,7 +133,7 @@ Release notes for older C++ versions are also available. For information on what
117
133
118
134
**C++ IntelliSense**
119
135
120
-
-[When importing a C++20 module or header unit, IntelliSense may stop working or 'There are too many errors' error is shown](https://aka.ms/vcmoduleintellisenseinfo).
136
+
-[`When importing a C++20 module or header unit, IntelliSense may stop working or 'There are too many errors' error is shown`](https://aka.ms/vcmoduleintellisenseinfo).
121
137
122
138
For more information on other open issues and available workarounds for C++ in Visual Studio 2022, see the C++ Developer Community [issues list](https://developercommunity.visualstudio.com/search?space=62&stateGroup=active&ftype=problem&sort=votes&q=2022).
0 commit comments