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/msvc-conformance-improvements.md
+83-6Lines changed: 83 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,51 @@ struct S
88
88
89
89
This change allows you to use the explicit object parameter syntax (deducing `this`) in assignment and comparison operators, providing more consistent syntax across different types of member functions.
90
90
91
+
92
+
### P2266R1 : Simpler implicit move
93
+
94
+
The introduction of [P2266R1](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html) may cause code that was previously treated as an lvalue to be treated as an xvalue or a prvalue. For example:
95
+
96
+
```cpp
97
+
#include<utility>
98
+
99
+
template<typename T>
100
+
T& f(T&& t)
101
+
{
102
+
return t;
103
+
}
104
+
105
+
struct S { };
106
+
107
+
void g()
108
+
{
109
+
S s1{ };
110
+
S& s2 = f(std::move(s1));
111
+
}
112
+
```
113
+
114
+
In C++20, and earlier, this code would have compiled because even though the type of `t` is `S&&` the use of `t` in `return t` is treated as a glvalue and so it can bind to the return type.
115
+
116
+
With C++23, `t` is treated as an xvalue and so it can't bind to an lvalue reference.
117
+
118
+
One fix is to change to the return type of the function from `T&` to `T&&` but this may affect code that calls this function. An alternative is to use the feature test macro that is associated with this change. For example:
Adding the cast means that the value-category of the return expression is now an lvalue and so it can bind to the return type.
135
+
91
136
### P2280R4: References to unknown values during constant evaluation
92
137
93
138
[P2280R4](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2280r4.html) allows references to unknown values during constant evaluation, relaxing restrictions on `constexpr` evaluation.
@@ -126,29 +171,61 @@ MSVC Build Tools v14.50 includes numerous smaller conformance improvements that
126
171
127
172
For more information about compiler improvements and bug fixes in MSVC Build Tools v14.50, see [C++ Language Updates in MSVC Build Tools v14.50](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-build-tools-v14-50/)
128
173
129
-
### Conformance Enhancements
174
+
## Conformance Enhancements
130
175
131
176
Improved adherence to C++ standards:
132
177
133
-
#### Attribute Support
178
+
### Attribute Support
179
+
134
180
- Added support for [`[[maybe_unused]]` on labels](https://developercommunity.visualstudio.com/t/unreferenced-label-when-ref-hidden-by-if/102076).
135
181
- Fixed warning C4102 (unreferenced label) when the only reference was from a discarded `if constexpr` branch.
136
182
137
-
#### Template and Specialization Fixes
183
+
### Template and Specialization Fixes
184
+
138
185
- [Diagnosed ill-formed friend explicit specializations](https://developercommunity.visualstudio.com/t/Defining-explicit-function-template-spec/10933841) that were incorrectly accepted in C++20 or later.
- Improved [concept and constraint evaluation](https://developercommunity.visualstudio.com/t/VS-1714-if-constexpr-requires--does/10905731)
146
193
147
194
## Bug fixes
148
195
149
-
Bug fixes for C++ Modules, `constexpr`, and others were made in v14.50. For a detailed list of bug fixes, see [Compiler Improvements in v14.50](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-build-tools-v14-50/#compiler-improvements-in-v14.50)
196
+
Bug fixes for C++ Modules, `constexpr`, and other fixes were made in v14.50. For a detailed list of bug fixes, see [Compiler Improvements in v14.50](https://devblogs.microsoft.com/cppblog/c-language-updates-in-msvc-build-tools-v14-50/#compiler-improvements-in-v14.50)
197
+
198
+
**Encoding of certain non-type template arguments corrected**
199
+
200
+
Affects `/stdc++20` or later.
201
+
202
+
Certain non-type pointer type template arguments involving sub-objects could lead to linking issues or in some cases silent bad code generation where what should be distinct specializations collide.
203
+
204
+
```cpp
205
+
struct A
206
+
{
207
+
int x;
208
+
};
209
+
210
+
struct B
211
+
{
212
+
int y;
213
+
};
214
+
215
+
template <auto p> void f();
216
+
217
+
int main()
218
+
{
219
+
static A a;
220
+
static B b;
221
+
constexpr auto px = &a.x;
222
+
constexpr auto py = &b.y;
223
+
f<px>(); // incorrect encoding of argument 'px'
224
+
f<py>(); // incorrect encoding of argument 'py', collided with 'px'.
Copy file name to clipboardExpand all lines: docs/overview/visual-cpp-language-conformance.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Microsoft C/C++ language conformance"
3
3
description: "Microsoft C and C++ conformance updates by Visual Studio version."
4
-
ms.date: 10/31/2025
4
+
ms.date: 11/03/2025
5
5
ms.service: "visual-cpp"
6
6
ms.subservice: "cpp-lang"
7
7
---
@@ -197,6 +197,7 @@ For details on conformance improvements, see [C++ conformance improvements in Vi
197
197
| [`P2173R1 Attributes on Lambda-Expressions`](https://wg21.link/p2173r1)| no |
198
198
| [`P2186R2 Remove Garbage Collection Support`](https://wg21.link/p2186r2)| VS 2022 17.0 <sup>[23](#note_23)</sup> |
199
199
| [`P2201R1 Mixed string literal concatenation`](https://wg21.link/p2201r1)| no |
200
+
| [`P2266R1 Simpler implicit move`](https://wg21.link/p2266r1)| VS 2026 18.0 <sup>[24](#note_24)</sup> |
200
201
| [`P2223R2 Trimming whitespaces before line splicing`](https://wg21.link/p2223r2)| no |
201
202
| [`P2242R3 Non-literal variables (and labels and gotos) in constexpr functions`](https://wg21.link/p2242r3)| no |
202
203
| [`P2246R1 Character encoding of diagnostic text`](https://wg21.link/p2246r1)| VS 2022 17.0 <sup>[23](#note_23)</sup> |
@@ -575,7 +576,8 @@ A group of papers listed together indicates a Standard feature along with one or
575
576
**VS 2022 17.2** Supported in Visual Studio 2022 version 17.2.\
576
577
**VS 2022 17.3** Supported in Visual Studio 2022 version 17.3.\
577
578
**VS 2022 17.4** Supported in Visual Studio 2022 version 17.4.\
578
-
**VS 2022 17.5** Supported in Visual Studio 2022 version 17.5.
579
+
**VS 2022 17.5** Supported in Visual Studio 2022 version 17.5.\
580
+
**VS 2022 18** Supported in Visual Studio 2026 and beyond.
579
581
580
582
### Notes
581
583
@@ -646,6 +648,8 @@ These algorithms aren't presently parallelized:
646
648
647
649
<aname="note_23"></a> **23** In Visual Studio 2022 version 17.0 and up, these features are enabled by the [`/std:c++latest`](../build/reference/std-specify-language-standard-version.md) compiler option.
648
650
651
+
<aname="note_24"></a> **24** In Visual Studio 2026 version 18.0 and up, these features are enabled by the [`/std:c++latest`](../build/reference/std-specify-language-standard-version.md) compiler option.
652
+
649
653
<aname="note_C11"></a> **C11** Compiler support for C11 and C17 requires Visual Studio 2019 version 16.8 or higher. Except as noted, C11 and C17 library support requires Windows SDK build 10.0.20211.0 or higher. For more information on how to install support for C11 and C17, see [Install C11 and C17 support in Visual Studio](./install-c17-support.md).
650
654
651
655
<aname="note_DR"></a> **DR** These features are enabled in all C++ [`/std`](../build/reference/std-specify-language-standard-version.md) compiler option modes. The C++ Standard committee adopted this change as a retroactive Defect Report to C++11 and all later versions.
0 commit comments