Daniela Engert wrote:
The repro is simple: create an otherwise empty TU with just "#include
" in it and compile. Our build system emits this compiler invocation: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.35.32215\bin\HostX64\x64\CL .exe /c /Zi /JMC /nologo /W4 /WX /diagnostics:caret /MP /Od /Ob1 /Oi /D QT_STATIC /D __QT6__ /D _UNICODE /D UNICODE /Zc:preprocessor /Gm- /EHsc /RTC1 /MDd /GS /arch:AVX2 /fp:fast /Zc:wchar_t /Zc:forScope /Zc:inline /Zc:rvalueCast /std:c++latest /permissive- /Fo"x64\Debug\\" /Fd"E:\HWPA\lib64\Debug\libEnvironment.pdb" /external:W4 /Gd /TP /FC /errorReport:prompt /Zc:checkGwOdr /Zc:templateScope /Zc:externConstexpr /Zc:__cplusplus /utf-8 /Zc:throwingNew /Zc:strictStrings /bigobj Log.cpp
The culprit here is /Zc:templateScope. This is not set by default (and I don't see it in the IDE at all), and there's no error without it. (/permissive- is also required for the error.) https://learn.microsoft.com/en-us/cpp/build/reference/zc-templatescope?view=... "The /Zc:templateScope option is new in Visual Studio 2022 version 17.5 preview 1. The option is off by default even when the code is compiled using the /permissive- option (or an option that implies /permissive-, such as /std:c++20 or /std:c++latest)."