Module interface of M:void g(); // #1 void h(); // #2 template <typename T> int j; // #3
Module interface of N:int g(); // same entity as #1, different type namespace h {} // same entity as #2, not both namespaces template <int X> int j; // same entity as #3, non-equivalent template heads
Other translation unit:import M; import N; // IFNDR due to the mismatched pairs above — end example]
Translation unit #1:struct S; consteval { std::meta::define_aggregate(^^S, {}); } // #1
Translation unit #2:struct S {}; // IFNDR, definition here, injected declaration at #1 — end example]
Translation unit #1:export module M:A; // module partition void f() {} // #1 void g() {} // #2
Translation unit #2:export module M:B; // module partition void f() {} // IFNDR, #1 not reachable
Translation unit #3:export module M; // primary module interface unit export import :A; void g(); // error: #2 is reachable — end example]
Translation unit #1:inline void f() {} // #1 inline void g() {} // #2 inline void h() {[]{}();} // #3 namespace { int i = 0; } inline void j() {++i;} // #4
Translation unit #2:inline void f() {} // OK, same as #1 inline void g() {;} // IFNDR, different sequence of tokens than #2 inline void h() {[]{}();} // IFNDR, closure has different type than #3 namespace { int i = 0; } inline void j() {++i; } // IFNDR, i refers to different entity than in #4 — end example]
Source file "a.h":enum { a };
Source file "b.h":enum { a, b };
Source file "main.cpp":import "a.h"; import "b.h"; auto n = decltype(a)::b; // IFNDR, more than one unnamed enum definition reachable at // this point but their types are not the same — end example]
Translation unit #1:int x = 5; // initializing declaration of x
Translation unit #2:extern constinit int x; // IFNDR, not reachable from initializing declaration of x — end example]
Translation unit #1:inline int f();
Translation unit #2:int f() { return 17; } // IFNDR, end of definition domain but no inline declaration of f is reachable — end example]
Translation unit #1:inline int f(int x, int y = 2); inline int f(int x = 1, int y); // IFNDR, default arguments of f are 1 and 2
Translation unit #2:inline int f(int x = 3, int y = 4); // IFNDR, default arguments of f are 3 and 4 — end example]
Translation unit #1:int f(int x) pre(x >= 0); // IFNDR, pre present, not present in the other first declaration of f int g(int x) pre(x == 0); // IFNDR, pre differs from the other first declaration of g int h(int x) pre(x <= 0); // OK, pre equivalent to pre on the other first declaration of h
Translation unit #2:int f(int x); // IFNDR, pre not present, present in the other first declaration of f int g(int x) pre(x != 0); // IFNDR, pre differs from the other first declaration of g int h(int y) pre(y <= 0); // OK, pre equivalent to pre on the other first declaration of h — end example]
Translation unit #1:extern "C" { void f(); }
Translation unit #2:extern "C++" { void f(); } // IFNDR, different language linkage — end example]
Translation unit #1:struct S { int x; } s, *p = &s;
Translation unit #2:struct alignas(16) S; // IFNDR, definition of S lacks alignment extern S* p; — end example]
Translation unit #1:int h(int x [[indeterminate]]); // IFNDR, mismatched [[indeterminate]] to other first declaration of h
Translation unit #2:int h(int x); // IFNDR, mismatched [[indeterminate]] to other first declaration of h — end example]
Translation unit #1:[[noreturn]] void f() {}
Translation unit #2:void f(); // IFNDR, declared without noreturn — end example]
Translation unit #1:export module M; // primary module interface unit export import :A;
Translation unit #2:export module M:A; // OK, directly exported by M export import :B;
Translation unit #3:export module M:B; // OK, indirectly exported by M
Translation unit #4:export module M:C; // IFNDR, not directly or indirectly exported by M — end example]
Translation unit #1:export module M; module :private; // private module fragment
Translation unit #2:module M:A; // IFNDR, partition of M with private module fragment — end example]
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]