*shrug*
I don't really care if you agree or disagree. I also don't have an issue with you notifying people of compatibility issues when it comes to C++ compilers. What I have an issue with is that you never complete the information. You always only tell half the story. It is not a template issue. It is an ABI issue.
You offered me the challenge of passing a `std::string' instance across module boundaries of an unfamiliar call frame or ABI? I don't have to try such a challenge. I know it will not work. I've been programming for over twenty years. I offer you this challenge. Compile the code I've included here and attempt to export it across module boundaries of an unfamiliar call frame or ABI. There is no template code here. There is no exceptions used here. It still will not work. It may work for any particular compiler or set of compilers, but you are still limiting the target consumers to a specific set of tools. This is the nature of C++.
The way C++ compilers pass the `this' pointer to methods, the way C++ compilers store the virtual table pointers, the way C++ compilers mangle names, all of it varies not just between different compilers, different versions of the same compilers, different versions of the relevant linker, different versions of the libraries, different versions of the headers, different defines used when building the libraries, but even with compiler options that may seem trivial when passed during building or linking the primary executable or shared library.
If you are worried about a shared library being useful across different versions of a C++ compiler (the primary scenario you usual reference) you must not export ANY C++ entity whether or not the source uses templates.
If you are going to export any C++ entity as part of the interface for public consumption, you may as well export templates and exceptions as well if your target compiler supports it because the other C++ entities you may wish to export are also tied to the particulars of a build.
Soma
Code:
class base
{
virtual void go();
};
class d1: public base
{
virtual void go()
{
std::cout << "d1" << '\n';
}
};
class d2: public base
{
virtual void go()
{
std::cout << "d2" << '\n';
}
};