Below is a reduced test case exemplifying the issue. // main.cpp #include <assert.h> struct Data { int ref; }; struct ConstData { const Data header; }; // < problematic const extern ConstData sharedNull; struct File { File() { assert(sharedNull.header.ref == -1); } }; File global; ConstData sharedNull = { { -1 } }; int main() {}Removing the const in the commented line produces the expected results below, but I don't see why that should trigger zero-initialization followed by dynamic-initialization of the global sharedNull.Changing the const-ness of the global sharedNull variable doesn't affect the results either way. The issue has also been reproduced in optimized builds.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...