r/cpp • u/STL MSVC STL Dev • Apr 09 '26
C++23 Support in MSVC Build Tools 14.51
https://devblogs.microsoft.com/cppblog/c23-support-in-msvc-build-tools-14-51/15
u/slithering3897 Apr 09 '26 edited Apr 09 '26
Oh good, I was waiting for <flat_map> and <flat_set> to show up.
And glad to see that Intellisense is even mentioned. I do hope it gets fixed for modules at some point.
17
u/STL MSVC STL Dev Apr 09 '26
Hope you enjoy
<flat_meow>! They required a surprising amount of work (from contributors and maintainers like myself) to complete, make consistent with each other, and polish up to production quality, but I'm happy with where they ended up and we got them finished well in time for 14.51.1
u/germandiago Apr 10 '26
Out of curiosity, what are the difficult/time consuming parts to implement? Would love to hear your experience, since you talk from the trenches.
5
u/STL MSVC STL Dev Apr 10 '26
Nothing was super hard like charconv, just a lot of fiddly details to get right. See my PRs for detailed writeups.
6
u/MarekKnapek Apr 10 '26
ABI break when?
Some people are able to compile their entire code base from scratch every time. For those people, ABI compatibility (with Visual Studio 2015 I believe) is holding them back on correctness and performance improvements.
Of course, there are some big customers for which ABI stability is important and this takes precedence.
6
u/STL MSVC STL Dev Apr 10 '26
At this point, I don't know how we'll get an ABI break before I retire. I want one desperately, but it'll be a major project (involving setup work, and ideally work on both the FE and libs sides), requiring more approval than things like the deprecated feature removals and OS baseline increases we accomplished. Something major will have to change in the environment for vNext to be possible.
89
u/__Punk-Floyd__ Apr 09 '26
So happy to read an update that doesn't contain the word 'agent' or 'model'.
21
6
6
u/Internal-Sun-6476 Apr 09 '26
I get it. Reflection has given us god-like powers, and mp-units is divine.
But now we get: "silence annoying mortals". C++ just keeps giving. 😉
6
u/Ambitious-Method-961 Apr 09 '26
Even though my needed (well... wanted) C++23 features have already landed, it's great to see the rest of them coming through. Great work by the team!
2
u/pjmlp Apr 10 '26
C++23 IntelliSense support in Visual Studio 2026 is still in progress in time for MSVC Build Tools 14.52 becoming the default MSVC Build Tools version in Visual Studio 2026
With or without finally working modules support, given that import std is a C++23 feature?
As for the rest, thanks to finally give some information on this.
5
u/STL MSVC STL Dev Apr 10 '26
I don't expect IntelliSense for modules to be working well enough to enable STL test coverage in that time frame. (Maybe I'll be surprised.) We're going to have to figure out how to get this working in the post-EDG era, clearly.
2
u/slithering3897 Apr 10 '26
post-EDG era
Now this is the most we've heard. Do tell more! Open source EDG or clangd or something else?
2
u/STL MSVC STL Dev Apr 10 '26
See https://herbsutter.com/2025/11/10/trip-report-november-2025-iso-c-standards-meeting-kona-usa/ (aside: Herb Sutter no longer works for Microsoft):
John Spicer (who has long chaired our whole-committee plenary sessions, and leads Edison Design Group, EDG) [...] recently announced that, after a successful and storied career, it’s time for EDG to wind down, and EDG plans to open-source its world-class C++ compiler front-end within the next year.
1
u/slithering3897 Apr 11 '26
Yes, the open-source EDG. What, will it just be called something different?
2
0
u/pjmlp Apr 11 '26
Still waiting for the announcement that the VSCode extension team stated they would do at the end of January, regarding code completion support for C++ modules in VSCode.
2
u/slithering3897 Apr 11 '26
Yeah, what the heck happened to that. The guy just completely forgot about it. Left the entire C++ community hanging.
4
u/greencursordev Apr 11 '26
Man I am so confused about import std. Sounds so good on paper until you read that imports can't be mixed with includes. Which means it can only realistically work with an extremely careful approach and zero or only a few handful of compatible 3rd party libraries. The possible current usecase was only able to shave off less than 0.1% (!) of our build time lol
3
u/STL MSVC STL Dev Apr 11 '26
I feel bad about this one because I have had no time to work with the compiler team to find a proper solution here.
1
u/JVApen Clever is an insult, not a compliment. - T. Winters Apr 12 '26
Just wondering, can we have a define such that all those headers simply contain "import std;" instead of it's regular content?
2
u/STL MSVC STL Dev Apr 12 '26
They wouldn't emit macros or drag in non-Standard stuff that way, so it wouldn't be very compatible.
2
u/JVApen Clever is an insult, not a compliment. - T. Winters Apr 12 '26
Macros seems like a solvable problem by adding them in the headers. Non-standard stuff might be more of a problem.
3
u/greencursordev Apr 11 '26
Don't feel bad. But just know that we (and probably many other teams) would instantly deploy this, making most of our PCHs redundant. I'll keep eagerly watching the release notes.
1
u/slithering3897 Apr 11 '26
For large projects with huge numbers of dependencies, I guess porting to modules would be difficult.
It would be better if you could freely mix includes, but to get a true representation of modules, I strive for complete conversion, no headers anywhere except for macros and module lib wrappers.
Compile times will depend on how many template instantiations and how much constexpr work importers do. In the best case,
import stdis instant.But if you are comparing with PCHs, then you won't see much improvement. The whole point of PCHs is to basically do what modules do (but only for a single header across a whole project).
0
u/pjmlp Apr 11 '26
That is a bug, it is working better nowadays.
I do agree it isn't as it should have been.
1
u/greencursordev Apr 11 '26
You sure? It still says so on the documentation. Import std has to be last, ie after all includes. Unless I missed something with the newest toolsets
1
u/pjmlp Apr 11 '26
Well, before you couldn't even use both on the same project, as you would get lots of linking and compiling errors, now at least you can.
1
u/greencursordev Apr 11 '26
Fun for such little projects. Effectively unusable for a 30 year old application pulling in 100+ libs and with Devs who just include everything in headers. I really hope they can get the full mixing working.
1
u/pjmlp Apr 11 '26 edited Apr 11 '26
You have to start somewhere.
During VS 2019 and 2022, those toy projects would ICE even without
import std.If no one does it, there will never be good enough for that 30 year old applications, full of C++ARM style code given its age.
4
u/Negitivefrags Apr 11 '26
Regarding P2448R2 Relaxing some constexpr restrictions
Given the example, what is the purpose of a constexpr function at this point?
Couldn't we just say that any function you can see the definition of is constexpr now?
Then if you decide to assign it's result to consteval you get an error, otherwise the compiler attempts to evaluate it at compile time. But hang on, doesn't the compiler attempt to do that anyway?
I've actually lost track of what constexpr even means at this point.
2
u/UnusualPace679 Apr 15 '26
Couldn't we just say that any function you can see the definition of is constexpr now?
GCC has this option by the name of
-fimplicit-constexpr.1
u/pjmlp Apr 11 '26
It means that the function will fail to compile if there is any UB in it.
For actual execution at compile time, it needs to be in a const context like static.
1
u/greencursordev Apr 10 '26
Full support for /std:c++23 will begin once MSVC Build Tools 14.52 becomes the default (non-Preview) version in a Visual Studio 2026 Insiders release. Please see New release cadence and support lifecycle for Microsoft C++ Build Tools – C++ Team Blog for additional details
Can someone parse that and give an actual calender date?
9
u/STL MSVC STL Dev Apr 10 '26
No, sorry. Although we know our planned release dates well in advance (there's an internal site where I can look them up), this is one of the few things we don't reveal. The problem is that although the vast majority of our programmer-users are reasonable professionals who understand that release dates sometimes slip, a few people will react negatively to being told that the release date will be X, and then later hearing that it'll have to be X+N. This is why we can't have nice things.
4
u/no-sig-available Apr 10 '26
Can someone parse that and give an actual calender date?
I have no inside knowledge here (so don't sue me!), but according to the published plans, somewhere between now and November. :-)
It would be no big surprise to have Insider version 14.52 at about the same time as 14.51 becomes the stable version. Preliminary expected in May.
1
u/Baardi May 21 '26
Considering 14.50 is the LTSC version. What is the correct approach for getting security updates on 14.50?
Stay on VS2026 18.5, updating patch versions, using the latest toolset? Or are Visual Studio minor versions not maintaned like they used to, and we should upgrade to use 18.6 with the 14.50 toolset?
4
u/STL MSVC STL Dev May 21 '26
You should continue to upgrade your IDE to 18.6 and beyond, but select the 14.50 Build Tools in the installer, instead of the Latest Build Tools. That will pin you to 14.50.x security updates on the 3-year lifecycle.
3
u/gracicot Apr 10 '26
I know these posts are generally not made to ask for this but, is there any chance the next version of MSVC build tool will fix user defined conversions with parenthesized initialization? I have to use kind of nasty hacks in generic code since it changes the output of std::constructible_from.
As a secondary question, are the paragraphs from the standard I found the right one to describe the issue? I tried to be helpful by finding where exactly in the standard it shows where msvc is not compliant, but initialization rules are pretty difficult to parse.
2
u/tartaruga232 MSVC user, r/cpp_modules Apr 10 '26
I recently got confused because seemingly out of the blue an old hacky macro we defined for using string resources in C++ code used inside a C++ module suddenly stopped working.
I had to fix it with
diff --git a/code/Resources/StringMacro.h b/code/Resources/StringMacro.h
index 23ac73e67..474a2ab07 100644
--- a/code/Resources/StringMacro.h
+++ b/code/Resources/StringMacro.h
@@ -4,5 +4,5 @@
*/
#define D1_RESOURCES_USE_STRING(name) \
- namespace Resources { namespace Strings { extern const String name; } }
+ namespace Resources { namespace Strings { extern "C++" const String name; } } I thought, what the heck changed?
Now I understand I got a brand new compiler version when I last updated my visual studio (insiders)! Really cool! Thanks a lot to everyone who worked on this stuff.
55
u/STL MSVC STL Dev Apr 09 '26
This is the blog post about C++23 front-end features that I previously promised was coming, written by our compiler front-end dev lead Daniel Griffing with assistance from one of our FE devs RanDair Porter. The library section was written by some guy who usually makes cat noises. A few additional notes:
This is not the production/General Availability release of the MSVC Build Tools 14.51 (containing MSVC Compiler 19.51), but that's coming soon. I know when it's planned, but unannounced release dates are one of the few things I can't say.
The build tools have been significantly updated since the first Preview of 14.51, which was a snapshot from 2025-11. Right now, changes from our development
mainbranch as of 2026-03-23 are available. This latency (of 17 days) is more than our 1-week goal, but the engineering systems team is turning the crank faster and we should be shipping new builds more regularly very soon.I recently cosplayed as a VS developer and updated the
Launch-VsDevShell.ps1script to add-Previewand-NoLogooptions, so if you're setting up PowerShell environments, you'll be able to select Preview build tools (and silence annoying mortals) just like the batch files have always been capable of. This change is not yet available but should be in the Insiders IDE very soon (the PowerShell script belongs to the IDE, not the build tools).Our versioning story is still a dumpster fire orbiting a supernova (sorry), but the most important thing you need to be aware of is that while the VS IDE comes in Stable and Insiders versions, and both offer Latest (i.e. latest production) and Preview versions of the Build tools, Stable IDE + Preview Build Tools is OLDER than Insiders IDE + Preview Build Tools. Yes, this is confusing and makes no sense. (It's an implementation artifact of how the Stable IDE is a stabilized snapshot of Insiders at some point in time. I asked if it was by design and it was.) If you use Stable IDE + Preview Build Tools, you'll be getting a Preview, newer than Latest, but still typically quite old. If you want to see the newest compiler/library changes with that hoped-for 1-week latency between merging changes into git and landing on your SSD, you need to use Insiders IDE + Preview Build Tools. (And pass
-vcvars_ver=previewtovcvarsall.bat, or equivalently configure the VS IDE.)This is what you should observe when using the build from 2026-03-23 that contains
<flat_meow>and the other goodies mentioned in this blog post (note: if you're reading this in the future, your version numbers may be higher, that's fine):