In the case where the template class itself is already dllexport, the
implicit instantiation will have already emitted all members. When we
check the explicit instantiation definition, the Specialization will
have inherited the dllexport attribute, so we'll attempt to emit all
members for a second time, which causes an assertion failure. Restrict
the exporting to when the dllexport attribute is newly introduced by
the explicit instantiation definition.
Fixes PR31608.