|
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/14/2023 |
| 4 | +ms.date: 12/07/2023 |
5 | 5 | ms.technology: "cpp-language"
|
6 | 6 | ---
|
7 | 7 | # C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2022
|
@@ -119,111 +119,6 @@ namespace Gui
|
119 | 119 | }
|
120 | 120 | ```
|
121 | 121 |
|
122 |
| -## <a name="improvements_178"></a> Conformance improvements in Visual Studio 2022 version 17.8 |
123 |
| - |
124 |
| -Visual Studio 2022 version 17.8 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler. |
125 |
| - |
126 |
| -### /FU issues an error |
127 |
| - |
128 |
| -The C compiler used to accept the `/FU` option, even though it hasn't support managed compilation for some time. It now issues an error. Projects that pass this option need to restrict it to C++/CLI projects only. |
129 |
| - |
130 |
| -### C++ Standard Library |
131 |
| - |
132 |
| -The C++23 named modules `std` and `std.compat` are now available when compiling with `/std:c++20`. |
133 |
| - |
134 |
| -For a broader summary of changes made to the C++ Standard Library, see [STL Changelog VS 2022 17.8](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-178-preview-3). |
135 |
| - |
136 |
| -## <a name="improvements_177"></a> Conformance improvements in Visual Studio 2022 version 17.7 |
137 |
| - |
138 |
| -Visual Studio 2022 version 17.7 contains the following highlighted conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler. |
139 |
| - |
140 |
| -### Added `/std:clatest` to the C compiler |
141 |
| - |
142 |
| -This switch behaves like the `/std:c++latest` switch for the C++ compiler. The switch enables all currently implemented compiler and standard library features proposed for the next draft C standard, as well as some in-progress and experimental features. |
143 |
| - |
144 |
| -### C++ Standard Library |
145 |
| - |
146 |
| -The `<print>` library is now supported. See [P2093R14 Formatted output](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2093r14.html). |
147 |
| - |
148 |
| -Implemented `views::cartesian_product`. |
149 |
| - |
150 |
| -For a broader summary of changes made to the Standard Template Library, see [STL Changelog VS 2022 17.7](https://github.com/microsoft/STL/wiki/Changelog#vs-2022-177). |
151 |
| - |
152 |
| -### `using` conformance |
153 |
| - |
154 |
| -Previously, the `using` directive could cause names from used namespaces to remain visible when they shouldn't. This could cause unqualified name lookup to find a name in a namespace even when there's no `using` directive active. |
155 |
| - |
156 |
| -Here are some examples of the new and old behavior.\ |
157 |
| -References in the following comments to "(1)" mean the call to `f<K>(t)` in namespace `A`: |
158 |
| - |
159 |
| -```cpp |
160 |
| -namespace A |
161 |
| -{ |
162 |
| - template<typename K, typename T> |
163 |
| - auto f2(T t) |
164 |
| - { |
165 |
| - return f<K>(t); // (1) Unqualified lookup should not find anything |
166 |
| - } |
167 |
| -} |
168 |
| - |
169 |
| -namespace B |
170 |
| -{ |
171 |
| - template<typename K, typename T> |
172 |
| - auto f(T t) noexcept |
173 |
| - { // Previous behavior: This function was erroneously found during unqualified lookup at (1) |
174 |
| - return A::f2<K>(t); |
175 |
| - } |
176 |
| -} |
177 |
| - |
178 |
| -namespace C |
179 |
| -{ |
180 |
| - template<typename T> |
181 |
| - struct S {}; |
182 |
| - |
183 |
| - template<typename, typename U> |
184 |
| - U&& f(U&&) noexcept; // New behavior: ADL at (1) correctly finds this function |
185 |
| -} |
186 |
| - |
187 |
| -namespace D |
188 |
| -{ |
189 |
| - using namespace B; |
190 |
| - |
191 |
| - void h() |
192 |
| - { |
193 |
| - D::f<void>(C::S<int>()); |
194 |
| - } |
195 |
| -} |
196 |
| -``` |
197 |
| - |
198 |
| -The same underlying issue can cause code that previously compiled to now be rejected: |
199 |
| - |
200 |
| -```cpp |
201 |
| -#include <memory> |
202 |
| -namespace Addin {} |
203 |
| -namespace Gui |
204 |
| -{ |
205 |
| - using namespace Addin; |
206 |
| -} |
207 |
| - |
208 |
| -namespace Addin |
209 |
| -{ |
210 |
| - using namespace std; |
211 |
| -} |
212 |
| - |
213 |
| -// This previously compiled, but now emits error C2065 for undeclared name 'allocator'. |
214 |
| -// This should be declared as 'std::allocator<T*>' because the using directive nominating |
215 |
| -// 'std' is not active at this point. |
216 |
| -template <class T, class U = allocator<T*>> |
217 |
| -class resource_list |
218 |
| -{ |
219 |
| -}; |
220 |
| - |
221 |
| -namespace Gui |
222 |
| -{ |
223 |
| - typedef resource_list<int> intlist; |
224 |
| -} |
225 |
| -``` |
226 |
| - |
227 | 122 | ## <a name="improvements_176"></a> Conformance improvements in Visual Studio 2022 version 17.6
|
228 | 123 |
|
229 | 124 | Visual Studio 2022 version 17.6 contains the following conformance improvements, bug fixes, and behavior changes in the Microsoft C/C++ compiler.
|
|
0 commit comments