This implements what I believe is the final piece of PR11170, modulo bugs.
Consider the following code:
template <typename T> class Base {}; class __declspec(dllexport) class Derived : public Base<int> {}
When the base of an exported or imported class is a class template specialization, MSVC will propagate the dll attribute to the base. In the example code, Base<int> becomes a dllexported class.
My patch does this when the base hasn't been instantiated yet (unless that instantiation already has the attribute), and warns otherwise. This is different from MSVC, which allows changing a specialization back and forth between dllimport and dllexport and seems to let the last one win. Changing the dll attribute after instantiation would be hard for us, and doesn't seem to come up in practice, so I think this is a reasonable limitation to have.
MinGW doesn't do this propagation thing.