Boost logo

Boost :

From: Daniela Engert (dani_at_[hidden])
Date: 2023-02-27 16:02:33


Am 27.02.2023 um 16:57 schrieb Peter Dimov via Boost:
> Daniela Engert wrote:
>> The repro is simple: create an otherwise empty TU with just "#include
>> <boost/log/sinks.hpp>" 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=msvc-170
>
> "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)."

Right. It's a conformance flag that you need to opt into to match gcc's
and clang's behaviour. From the same site:

"The C++ Standard doesn't allow the reuse of a template parameter's name (or shadowing) for another declaration within the scope of the template. The /Zc:templateScope compiler option enables an error check for such shadowing."

-- 
PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk