Commit 783da0a
Disable constinit on MSVC for static library builds
38927bf cleaned up the constinit suppressions based on our understanding of the Windows/MSVC limitations at the time. It turns out this was incomplete and, by restoring constinit on static library MSVC builds, we broke something.
On MSVC, but not clang-cl, the workaround must extend to static library builds too. Although pointers to same-dll symbols are fine and MSVC, with optimizations, will avoid a static initializer, it doesn't seem to consistently recognize it in the type systems, so we can't enforce constinit. See https://godbolt.org/z/cYeYaaWq5
On MSVC, but not clang-cl, the above workaround must extend to static library builds too. MSVC can avoid a global constructor when initializing structures containing pointers to same-dll symbols, it relies on the optimizer for this, so we can't enforce constinit. This limitation does not apply to constexpr. See https://godbolt.org/z/hsT9e3zs4
Add a Windows Bazel C++20 build configuration, which would have caught this.
PiperOrigin-RevId: 8588013891 parent 6ba0e6f commit 783da0a
File tree
2 files changed
+11
-0
lines changed- .github/workflows
- src/google/protobuf
2 files changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
434 | 438 | | |
435 | 439 | | |
436 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
427 | 434 | | |
428 | 435 | | |
429 | 436 | | |
| |||
0 commit comments