inline variable is initialized more than once
问题 Im seeing some examples of inline const variable getting initialized (and destructed) 3 times with visual studio 2017. Is this is a bug with the linker ? or is this supposed to happend in some other way ? linker Comdat folding is set to Off. Example Code: #pragma once struct A { A() { static int count = 0; ++count; ASSERT(count == 1); } ~A() { } }; inline const A a = A(); In my solution, I have the assert fire twice (A constructor called 3 times). Inspecting the call stack shows all call