% & ".\clang.exe" --% -o - -S -emit-llvm .\test.mm
.\test.mm:14:7: error: definition with same mangled name as another definition
TPtr get() { return nullptr; }
^
.\test.mm:14:7: note: previous definition is here
1 error generated.
Since the types Root<One*> and Root<Two*> do not differ in function, they should not result in functionally different template instantiations. However, they do. As they do not differ in mangled name, the compiler has effectively emitted two functions with the same mangled name.
Since the implementation of F<T<X*>>::get does not change based on X, a potential workaround is to fall back to F<T>.
_https://bugs.llvm.org/show_bug.cgi?id=25343_
The following code triggers a spurious error:
Since the types
Root<One*>
andRoot<Two*>
do not differ in function, they should not result in functionally different template instantiations. However, they do. As they do not differ in mangled name, the compiler has effectively emitted two functions with the same mangled name.Since the implementation of
F<T<X*>>::get
does not change based onX
, a potential workaround is to fall back toF<T>
.