Read the question carefully, please.
I was using this base class for my types where I need the Singleton pattern:
#pragma once
template<typename T>
class singleton
{
private:
    static T* g_pInstance;
public:
    static T* getInstance()         { return g_pInstance; }
public:
    singleton()                     { g_pInstance = (T*)this; }
    ~singleton()                    { if(g_pInstance == this) g_pInstance = nullptr; }
};
template<typename T>
T* singleton<T>::g_pInstance = nullptr;
Usage (no *cpp file):
class Any : public singleton<Any> { /* Done */ }
However, now I have a strange situation using such class from static library, g_pInstance pointer is already set to 0xccccccc (not initialized with zero), before anything was fine.
What is the reason?
UPDATE: compiler: vs 2013 x86
 
     
     
     
     
    