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/overview/cpp-conformance-improvements.md
+45-1Lines changed: 45 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "C++ conformance improvements in Visual Studio 2022"
3
3
description: "Microsoft C++ in Visual Studio is improving standards conformance and fixing bugs regularly."
4
-
ms.date: 11/12/2024
4
+
ms.date: 2/11/2025
5
5
ms.service: "visual-cpp"
6
6
ms.subservice: "cpp-lang"
7
7
---
@@ -19,6 +19,50 @@ For changes in earlier versions of Visual Studio:
19
19
| 2017 |[C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md)|
20
20
| 2003-2015 |[Visual C++ What's New 2003 through 2015](../porting/visual-cpp-what-s-new-2003-through-2015.md)|
21
21
22
+
## <aname="improvements_1713"></a> Conformance improvements in Visual Studio 2022 version 17.13
23
+
24
+
Visual Studio 2022 version 17.13 includes the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
25
+
26
+
For an in-depth summary of changes made to the Standard Template Library, including conformance changes, bug fixes, and performance improvements, see [STL Changelog VS 2022 17.13](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1713).
27
+
28
+
### Argument-dependent lookup (ADL) change
29
+
30
+
Language constructs such as range-for and structured bindings have special argument-dependent lookup rules for certain identifiers such as `begin`, `end`, or `get`. Previously, this lookup included candidates from the `std` namespace, even when namespace `std` is not part of the ordinary set of associated namespaces for argument-dependent lookup.
31
+
32
+
Programs that introduced declarations to `std` for these constructs no longer compile. Instead, the declarations should be in a normal associated namespace for the types involved (possibly including the global namespace).
33
+
34
+
```cpp
35
+
template <typename T>
36
+
structFoo {};
37
+
38
+
namespace std
39
+
{
40
+
// To correct the program, move these declarations from std to the global namespace
41
+
template <typename T>
42
+
T* begin(Foo<T>& f);
43
+
template <typename T>
44
+
T* end(Foo<T>& f);
45
+
}
46
+
47
+
void f(Foo<int> foo)
48
+
{
49
+
for (auto x : foo) // Previously compiled. Now emits error C3312: no callable 'begin' function found for type 'Foo<int>'
50
+
{
51
+
...
52
+
}
53
+
}
54
+
```
55
+
56
+
### Can't modify implementation-reserved macros
57
+
58
+
Previously, the compiler permitted changing or undefining certain implementation-provided macros such as `_MSC_EXTENSIONS`. Altering the definition of certain macros can result in undefined behavior.
59
+
60
+
Attempting to alter or undefine certain reserved macro names now results in the level-1 warning `C5308`. In `/permissive-` mode, this warning is treated as an error.
61
+
62
+
```cpp
63
+
#undef _MSC_EXTENSIONS // Warning C5308: Modifying reserved macro name `_MSC_EXTENSIONS` may cause undefined behavior
64
+
```
65
+
22
66
## <aname="improvements_1712"></a> Conformance improvements in Visual Studio 2022 version 17.12
23
67
24
68
Visual Studio 2022 version 17.12 includes the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
Copy file name to clipboardExpand all lines: docs/overview/what-s-new-for-visual-cpp-in-visual-studio.md
+103-4Lines changed: 103 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
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/12/2024
4
+
ms.date: 2/10/2025
5
5
ms.service: "visual-cpp"
6
6
ms.subservice: "ide"
7
7
ms.custom: intro-whats-new
@@ -12,10 +12,109 @@ ai-usage: ai-assisted
12
12
13
13
Visual Studio 2022 brings many updates and fixes to the Microsoft C++ compiler and tools. The Visual Studio IDE also offers significant improvements in performance and productivity, and now runs natively as a 64-bit application.
14
14
15
-
- For more information on what's new in all of Visual Studio, see [What's new in Visual Studio 2022](/visualstudio/ide/whats-new-visual-studio-2022?view=vs-2022&preserve-view=true).
15
+
- For more information on what's new in all of Visual Studio, see [What's new in Visual Studio 2022](/visualstudio/ide/whats-new-visual-studio-2022).
16
16
- For information about what's new in the C++ docs, see [Microsoft C++ docs: What's new](./whats-new-cpp-docs.md).
17
17
- For information about version build dates, see [Visual Studio 2022 Release History](/visualstudio/releases/2022/release-history).
18
18
19
+
## What's new for C++ in Visual Studio version 17.13
20
+
21
+
*Released February 2025*
22
+
23
+
| For more information about | See |
24
+
|---|---|
25
+
| What's new for C++ developers |[What's New for C++ Developers in Visual Studio 2022 17.13](https://devblogs.microsoft.com/cppblog/whats-new-for-c-developers-in-visual-studio-2022-17-13/)|
26
+
| Standard Library (STL) merged C++26 and C++23 features, LWG issue resolutions, performance improvements, enhanced behavior, and fixed bugs |[STL Changelog 17.13](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1713)|
27
+
| New features in the IDE |[Visual Studio 2022 version 17.13 Release Notes](/visualstudio/releases/2022/release-notes)|
28
+
| C++ language updates |[MSVC Compiler updates in Visual Studio 2022 17.13](https://devblogs.microsoft.com/cppblog/msvc-compiler-language-updates-in-visual-studio-2022-version-17-13/)|
29
+
| C++ language conformance improvements |[C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022 17.13](cpp-conformance-improvements.md#improvements_1713)|
30
+
31
+
A quick highlight of some of the new features:
32
+
33
+
-**C++ language enhancements**
34
+
35
+
- Try out C++23 preview features by setting the C++ Language Standard to `/std:c++23preview`. This setting enables the latest C++23 features and bug fixes. For more information, see [/std (Specify Language Standard Version)](../build/reference/std-specify-language-standard-version.md#stdc23preview).
36
+
- Support add for C++23’s `size_t` literal suffix which helps avoid truncations or signed comparison mismatches--especially when writing loops. For example:
37
+
```cpp
38
+
// Infinite loop if v.size > max unsigned int
39
+
for (auto i = 0u; i < v.size(); ++i)
40
+
{
41
+
...
42
+
}
43
+
44
+
// Fixed because of uz literal
45
+
for (auto i = 0uz; i < v.size(); ++i)
46
+
{
47
+
...
48
+
}
49
+
```
50
+
51
+
- Support for vector lengths for code generation on x86 and x64. For more information, see [/vlen](../build/reference/vlen.md).
52
+
- Support for Intel Advanced Vector Extensions 10 version 1. For more information about `/arch:AVX10.1`, see [/arch (x64)](../build/reference/arch-x64.md).
53
+
54
+
-**Standard Library enhancements**
55
+
56
+
- Standard library support for couroutines. In this example from [P2502R2](https://wg21.link/p2502r2), the `fib` function is a coroutine. When the `co_yield` statement is executed, `fib` is suspended and the value is returned to the caller. You can resume the `fib` coroutine later to produce more values without requiring any manual state handling:
57
+
58
+
```cpp
59
+
std::generator<int> fib()
60
+
{
61
+
auto a = 0, b = 1;
62
+
63
+
while (true)
64
+
{
65
+
co_yield std::exchange(a, std::exchange(b, a + b));
66
+
}
67
+
}
68
+
69
+
int answer_to_the_universe()
70
+
{
71
+
auto rng = fib() | std::views::drop(6) | std::views::take(3);
- Moved `system_clock`, `high_resolution_clock`, and `chrono_literals` from a commonly included internal header to `<chrono>`. If you see compiler errors that types like `system_clock` or user-defined literals like `1729ms` aren't recognized, include `<chrono>`.
77
+
- Improved the vectorized implementations of `bitset` constructors from strings, `basic_string::find_last_of()`, `remove()`, `ranges::remove`, and the `minmax_element()` and `minmax()` algorithm families.
78
+
- Added vectorized implementations of:
79
+
-`find_end()` and `ranges::find_end` for 1-byte and 2-byte elements.
80
+
-`basic_string::find()` and `basic_string::rfind()` for a substring.
81
+
-`basic_string::rfind()` for a single character.
82
+
- Merged C++23 Defect Reports:
83
+
-[P3107R5](https://wg21.link/P3107R5) Permit an efficient implementation of `<print>`.
84
+
-[P3235R3](https://wg21.link/P3235R3)`std::print` More types faster with less memory.
85
+
86
+
-**GitHub Copilot**
87
+
88
+
- GitHub Copilot Free is now available. Get 2,000 code completions and 50 chat requests per month at no cost.
89
+
- GitHub Copilot code completions provide autocomplete suggestions inline as you code. To enhance the experience of C++ developers, GitHub Copilot includes other relevant files as context. This reduces hallucinations while offering more relevant and accurate suggestions.
90
+
- You can now request a code review from GitHub Copilot from the Git Changes window:
91
+
:::image type="complex" source="./media/vs2022-copilot-git-changes-review.png" alt-text="A screenshot of the Git Changes window with the GitHub Copilot Review button highlighted.":::
92
+
The Git Changes window is open with the GitHub Copilot Review button highlighted.
93
+
:::image-end:::
94
+
95
+
GitHub Copilot looks for potential issues and creates comments for them:
96
+
97
+
:::image type="complex" source="./media/vs2022-copilot-comment-example.png" alt-text="A screenshot of the GitHub Copilot explaining an issue.":::
98
+
GitHub Copilot found an issue with the line if ( is_enabled_) new_site.disable(). It says it may be a mistake and should likely be if ( is_enabled_) new_site.enable() because the intention seem to be enabling the new site if the breakpoint is enabled.
99
+
:::image-end:::
100
+
101
+
To use this feature, ensure you have the following turned on:
- GitHub Copilot Edits is a new feature that can make changes across multiple files in your project. To start a new Edits session, click **Create new edit session** at the top of the GitHub Copilot Chat window:
106
+
107
+
:::image type="content" source="./media/vs2022-copilot-edit-session.png" alt-text="A screenshot of the GitHub Copilot Chat window. The Create new edit session button is highlighted.":::
108
+
109
+
Describe the changes you want to make and Copilot will suggest the relevant edits. You can preview the edits one-by-one and accept the ones you want or make corrections:
110
+
111
+
:::image type="complex" source="./media/vs2022-copilot-edit-session-example.png" alt-text="A screenshot of the GitHub Copilot Chat window displaying the files it edited.":::
112
+
GitHub Copilot is displaying a summary of the changes it made, such as 1. Create a new subclass range_breakpoint in include/libsdb/breakpoint.hpp" and 2. Implement the range_breakpoint class in src/breakpoint.cpp. An option to accept the changes is displayed.
113
+
:::image-end:::
114
+
115
+
-**CMake**
116
+
- Now supports CMake Presets v9. New macro expansions in a preset's include field. For more information, see [Macro expansion](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#macro-expansion) in the official CMake documentation.
117
+
19
118
## What's new for C++ in Visual Studio version 17.12
20
119
21
120
*Released November 2024*
@@ -48,7 +147,7 @@ A quick highlight of some of the new features:
48
147
:::image type="complex" source="./media/copilot-smart-variable-inspection.png" alt-text="A screenshot of the Autos window. The variable named it is NULL. The Ask Copilot icon next to it is highlighted.":::
49
148
The code that caused this problem is: for (auto it = h.animals_.begin(); it <= h.animals_.end(); it++).
50
149
:::image-end:::
51
-
If you click Ask Copilot icon for the `it` variable, it will tell you why it is `<NULL>`:
150
+
If you click Ask Copilot icon for the `it` variable, it tells you why it is `<NULL>`:
52
151
:::image type="complex" source="./media/copilot-smart-variable-explanation.png" alt-text="A screenshot of a GitHub Copilot window.":::
53
152
This error is inside a function defined as int calculate_number_of_cats(const house& h). The GitHub Copilot message says: "The value of the expression it is NULL, which means that the iterator is not pointing to any valid element in the vector animals_. In the context of your program, it is supposed to iterate over the animals_ vector in the house object to count the number of cat objects. Why it is null. Based on the locals and call stack context: the house object h has an empty animals_ vector (size=0). The loop condition it <= h.animals_.end() is incorrect. It should be it != h.animals_.end()."
54
153
:::image-end:::
@@ -90,7 +189,7 @@ A partial list of new features:
90
189
:::image type="complex" source="./media/include-diagnostics-improved.png" alt-text="A screenshot of the improved Included Files diagnostics results.":::
91
190
The Included Files view has a new column for the project. The Project column is selected and projects such as (Select All), CompilerIdC, OpenAL, common, and so on, are selected. The included files are listed by relative path and file name and grouped together.
92
191
:::image-end:::
93
-
- CMake debugging
192
+
-**CMake debugging**
94
193
- You can now debug your CMake scripts and `CMakeLists.txt` files in the Visual Studio debugger for CMake projects that target Linux via Windows Subsystem for Linux (WSL) or SSH. To start a CMake debugging session in Visual Studio, set a breakpoint in your `CMakeLists.txt` file and then navigate to **Project** > **Configure Cache with CMake Debugging**.
95
194
-**GitHub Copilot**
96
195
- When you hover over symbols in the code editor, click the Copilot **Tell me more** button in the Quick Info dialog to learn more about a given symbol:
0 commit comments