In this (partial) test case:
...
struct declspec(dllexport) C1 : public A <&uuidof(S1)>
{};
struct declspec(dllexport) C2 : public A<&uuidof(S2)>
{};
...
clang should be generating a single instantiation of A. It is instead generating two of them. This happens only in the presence of uuid.
Compiling this with clang this test case (dllexport with no uuid):
template <const char* s> class A {};
char s = 'a';
struct declspec(dllexport) C1 : public A <&s>
{};
struct declspec(dllexport) C2 : public A<&s>
{};
has the same(correct) behavior than MSVC:
ksh-3.2$ dumpbin /symbols t3.o | grep "class A"
008 00000000 SECT4 notype () External | ??4?$A@$1?s@@3DA@@QEAAAEAV0@AEBV0@@Z (public: class A<&char s> & cdecl A<&char s>::operator=(class A<&char s> const &))
00D 00000000 SECT5 notype () External | ??4?$A@$1?s@@3DA@@QEAAAEAV0@$$QEAV0@@Z (public: class A<&char s> & cdecl A<&char s>::operator=(class A<&char s> &&))
ksh-3.2$
The solution proposed in this patch is the generation a new template argument for uuid.
Let me know if you agree.