WinAPI, Visual Studio 2022, x86 app and C++20

Ugh, VS 2022 v17.5 update introduced some weird "wrinkle" when compiling WinAPI code with the C++ language standard set to C++20:

Build started...
------ Build started: Project: 04_menu_two, Configuration: Release Win32 ------
Scanning sources for module dependencies...
menu_two.c
Compiling...
menu_two.c
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1005,1): message : sorry: 'inline' function definition for 'ULONGLONG Int64ShllMod32(ULONGLONG,DWORD)' could not be written to module due to unrecognized expression or statement at 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1010,5)'.
If possible please provide a repro here: https://developercommunity.visualstudio.com
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1021,1): message : sorry: 'inline' function definition for 'LONGLONG Int64ShraMod32(LONGLONG,DWORD)' could not be written to module due to unrecognized expression or statement at 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1026,5)'.
If possible please provide a repro here: https://developercommunity.visualstudio.com
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1037,1): message : sorry: 'inline' function definition for 'ULONGLONG Int64ShrlMod32(ULONGLONG,DWORD)' could not be written to module due to unrecognized expression or statement at 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h(1042,5)'.
If possible please provide a repro here: https://developercommunity.visualstudio.com
Generating code
Previous IPDB not found, fall back to full compilation.
All 2 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code

Compiling as x64, nary a peep. Change the language standard to C++17 or earlier, and the x86 whinging goes away.

I don't even need to import any modules, just #include, and C++20 makes MSVC whine like a baby.

The WinAPI code I'm mucking around with is pure C based so C++ standard version shouldn't have any real relevance. VS v17.4 didn't complain about C++20. So why this now?
So do what it asks - and provide the repro and note that this is a regression issue. That's how issues get fixed. At one point I had several outstanding - but all except one have now been sorted.
Last edited on
I wouldn't know where to begin fixing the issue, and I tried to report issues before (and now) and was never able to do so. The feedback/report feature never works for me.
Last edited on
You can set compiler options for individual translation/compilation units. Tell VS to use C++17 only for those files.
Last edited on
I've done that, modify the compiler options at a unit level. I've also modified the overall language standard for each project in the solution when creating a desktop WinAPI project/solution. The latter method is the simplest way to change the option, I modified the system-wide C++ language standard to default to C++20 when creating a new project/solution.

http://www.cplusplus.com/forum/lounge/271176/

The issue as reported appears to have something to do with the __asm statement block in winnt.h. That is way over my head, dealing with assembly instructions.
The feedback/report feature never works for me.


Once you have a Microsoft id/password and have signed in, I've never had any issues reporting problems in VS. From VS use Help/Send Feedback/Report a problem. This will take you direct to reporting a problem. If not already then sign in, then provide the info required and Submit.
I have had issues every time. I tried several times about this issue and nothing went through.
Topic archived. No new replies allowed.