I think its mandatory in C++. It can cause some confusion and harder to maintain the code. You can try other methods like
class Initializer {
public:
static void init() {
// Initialization code
}
};
static bool dummy = (Initializer::init(), true);