OK, the story goes like this. I forgot to release one of my singletons and I'd finally had the last straw that my singleton class wasn't foolproof (it needed the programmer to dealocate it manually).
I didn't want to remove the manual-dealocation thing, but I did want to have an error if the programmer screwed up. Thus I added this code:
template <class T>
class ASingleton
{
private:
struct ReleaseCheck
{
ReleaseCheck() {}
~ReleaseCheck() {assert(!ASingleton<T>::ValidSingleton());}
};
static ReleaseCheck check;
... // rest of the class
};
template <class T> typename ASingleton<T>::ReleaseCheck ASingleton<T>::check;
Now, it didn't work and my breakpoints were comming up as question marks (ie: the destructor for ReleaseCheck wasn't being compiled).
So I decide to run it and pull it up in the watch window. I got something very, very strange:
ASingleton<APackageManager>::check CXX0070: Error: static member not present
ASingleton<APackageManager>::foo CXX0017: Error: symbol "foo" not found
ASingleton<APackageManager>::singleton 0x00d2abf8 {...} APackageManager *
In other words - the memeber that has always worked, works. The member that isn't even there dosn't work, and does so in the way one would expect. The member that I want to work - completly dosn't work and I have no idea why.
Now, a quick google reveals no results for
CXX0070 or
"static member not present". Searching MSDN with its own search engine revealed the same. So there is no handy documentation.
So the question, obviously, is this: WTF?
[Edited by - Andrew Russell on July 10, 2005 1:17:19 AM]