Source file "a.h":template <typename T> void f();
Source file "a.cpp":#include "a.h" int main() { f<int>(); // IFNDR, function template implicitly instantiated but not reachable definition } — end example]
Source file "a.h":#include <type_traits> template <typename T, typename Enabler = void> struct is_complete : std::false_type {}; template <typename T> struct is_complete<T, std::void_t<decltype(sizeof(T) != 0)>> : std::true_type {};
Source file "a.cpp":#include "a.h" struct X; static_assert(!is_complete<X>::value); // IFNDR, different specialization selected in "b.cpp"
Source file "b.cpp":#include "a.h" struct X { }; static_assert(is_complete<X>::value); // IFNDR, different specialization selected in "a.cpp" — end example]
Translation unit #1:namespace A { struct S {}; void f(S&, long x, int y); // #3 void g(S&, int x); // #4 }
Translation unit #2:namespace A { struct S {}; void f(S&, int x, long y); // #5 void g(S&, long x); // #6 } template <typename T> void h(T& t) { f(t, 1, 1); // Selects #5 in h<A::S>, would be ambiguous call if all declarations were considered. g(t, 1); // Selects #6 in h<A::S>, would select #4 if all declarations were considered. } — end example]
Source file "a.h":template <typename T> struct S {};
Translation unit #2:#include "a.h" template <> struct S<int> { int oops; }; // #1
Translation unit #3:#include "a.h" S<int> s; // IFNDR, #1 is not reachable but would have matched — end example]