I am trying to use extern templates in VS 2010.

In most cases, people use extern templates purely as an optimization, but in my case I actually need them for correctness; in the header, the type instantiating the template is forward declared, so I want to defer instantiation to the source file where I have a complete type. Otherwise I'll get a compilation error. (It's valid for the template itself to be incomplete in the header, since it's just a pointer.)

Header:
Code:
class AbstractFolder;
extern template class Watcher<AbstractFolder>;
Source:
Code:
#include "abstractfolder.h"
template class Watcher<AbstractFolder>;
I've *almost* got it working, but I've run into this:
error C2960: 'Watcher<T>' : inconsistent explicit instantiations, a previous explicit instantiation specified 'extern template'

This seems like one of the stupidest errors ever, since my intent is clearly to override the "extern" and force instantiation at that point, but the compiler doesn't seem to want to let me do that.

Unfortunately it's impossible to do this in a source file where the header is not included, since the header with the extern declaration is included from abstractfolder.h (which is the reason forward declarations are needed in the first place).

Two questions. First, is it possible to make VS2010 do what I want here? Second, we may be upgrading to VS2013 soon; will it give me the behavior I want?