-
Notifications
You must be signed in to change notification settings - Fork 15.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vs2019 update 16.10 : illegal initialization of constinit
entity with a non-constant expression
#8688
Comments
@maxgolov Thanks for posting this, I am seeing the same. Do you know which version of VSCommunity and Build Tools doesn't have this issue? On my local computer, I have VSCommunity 16.9.0 with
and everything compiles fine, but I have a Docker image where I am using 16.9.0 from chocolatey
with gRPC and Protobuf versions
and I still see this error in my Docker build image, even with 16.9.0 |
FWIW I changed my CXX flags to use c++17 instead of c++latest and I was able to get around this issue w/ Protobuf and MSBuild (in case this helps anyone in the future) - only c++latest gives this problem. I also did not need to downgrade MSbuild/VSCommunity as long as I changed those CXX flags (in my case, in CMake triggering MSBuild). |
@netpoetica - bug report repro steps indicate that: Since you are using |
…olbuffers/protobuf#8688 (#20) * CI: fix gcc & gcov * CI: remove compat test & benchmark in windows due to protocolbuffers/protobuf#8688
This appears to have been resolved in VS2019 update 16.11. On a side note: 16.11 was the first version to fully support C++20. In general, I would not expect |
What version of protobuf and what language are you using?
Version:
2021-04-07 version 3.15.8
Language: C++
What operating system (Linux, Windows, ...) and version?
Windows.
What runtime / compiler are you using (e.g., python version or gcc version)
Visual Studio 2019 msvc Update 19.10 . Latest version that just recently added support for
constinit
on May 25th - announcement here.What did you do?
Nothing horribly bad.. Steps to reproduce the behavior:
-std:c++latest
, e.g. for CMake that'd beset(CMAKE_CXX_STANDARD 20)
.port_def.inc
header .What did you expect to see
Code compiles.
What did you see instead?
Code fails to compile with errors:
Patch Proposal
The most trivial hacky patch would be to apply the same logic as applied for
__GNUC__
, the issue described in #8310 .Adding
!defined(_MSC_VER)
check - "resolves" the issue. And soconstinit
is not used:And the code works great after that even with latest Visual Studio 2019 compiler. This could be used as an interim patch to unblock customers using the latest compiler.
The text was updated successfully, but these errors were encountered: