https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83730
--- Comment #5 from Wilhelm M <klaus.doldinger64 at googlemail dot com> ---
Only for completeness: if you write the following, no guards are produced:
struct A {
A() = default; // if commented out, no guards are allocated
void foo() {}
};
template<typename T>
struct B {
static void foo() {
mTop.foo();
}
inline static T mTop{};
};
int main() {
B<A>::foo();
}
So the c++14 an c++17 variants produce the same guards if
default-initialization is used. But produce no guards if value-initialization
ist used or the defaulted ctor is removed. Thats strange ...