Clang warns (when using -Weverything
or Wglobal-constructors
) about constructors for static objects.
warning: declaration requires a global constructor
[-Wglobal-constructors]
A A::my_A; // triggers said warning
^~~~
Why is this relevant and how should one deal with this warning?
Simple example code:
class A {
// ...
static A my_A;
A();
};
A A::my_A; // triggers said warning
See Question&Answers more detail:os