Why C++ linker is silent about ODR violation?
问题 Let's consider some synthetic but expressive example. Suppose we have Header.h: Header1.h #include <iostream> // Define generic version template<typename T> inline void Foo() { std::cout << "Generic\n"; } Header2.h void Function1(); Header3.h void Function2(); Source1.cpp #include "Header1.h" #include "Header3.h" // Define specialization 1 template<> inline void Foo<int>() { std::cout << "Specialization 1\n"; } void Function1() { Foo<int>(); } Later I or some else defines similar conversion