Annex G (informative) Ill-formed, no diagnostic required [ifndr]

G.3 [basic]: Basics [ifndr.basic]

G.3.1[ifndr:basic.link.consistent.types]
Specified in: [basic.link]

Having multiple declarations of the same entity with different kinds when those declarations are not reachable from one another is ill-formed, no diagnostic required.
[Example 1: 

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]

G.3.2[ifndr:basic.def.odr.minimum.one.def]
Specified in: [basic.def.odr]

Not having a definition for a function or variable that is odr-used from a non-discarded statement ([stmt.if]) is ill-formed, no diagnostic required.
[Example 1: auto f() { struct A {}; return A{}; } decltype(f()) g(); auto x = g(); // IFNDR, function g is used but not defined in this translation unit, and cannot // be defined in any other translation unit because its type does not have linkage — end example]

G.3.3[ifndr:basic.def.odr.injected.match]
Specified in: [basic.def.odr]

Defining a definable item D with an injected declaration ([expr.const.reflect]) in one translation unit and a definition in a different translation unit when D is not attached to a named module or neither definition is reachable from the other is ill-formed, no diagnostic required.
[Example 1: 

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]

G.3.4[ifndr:basic.def.odr.maximum.one.def]
Specified in: [basic.def.odr]

If there are definitions in different translation units of a non-inline non-templated function or variable that are not attached to a named module or are not reachable from one another, the program is ill-formed, no diagnostic required.
[Example 1: 

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]

G.3.5[ifndr:basic.def.odr.definition.matches]
Specified in: [basic.def.odr]

If there are definitions in different translation units of a definable item D where
  • D is not defined by an injected declaration ([expr.const.reflect]),
  • D is not an inline or templated function or variable, and
  • D is not attached to a named module or the declarations are not reachable from one another,
that do not satisfy the matching rules described in [basic.def.odr], the program is ill-formed, no diagnostic required.
[Example 1: 

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]

G.3.6[ifndr:basic.def.odr.unnamed.enum.same.type]
Specified in: [basic.def.odr]

Having multiple unnamed enumeration definitions in the same scope that have the same first enumerator name and do not have typedef names for linkage purposes ([dcl.enum]) that are not the same enumeration is ill-formed, no diagnostic required.
[Example 1: 

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]

G.3.7[ifndr:basic.contract.vastart.contract.predicate]

The use of va_start ([cstdarg.syn]) within the predicate of a contract assertion is ill-formed, no diagnostic required.
[Example 1: void f(...) { va_list args; contract_assert((va_start(const_cast<decltype(args)>(args)), true)) // IFNDR } — end example]

G.3.8[ifndr:basic.contract.handler.replacing.nonreplaceable]

On platforms where the contract-violation handler is not replaceable ([dcl.fct.def.replace]) a function declaration which could be such a replacement function is ill-formed, no diagnostic required.
[Example 1: #include <contracts> void handle_contract_violation(const std::contracts::contract_violation& violation); // IFNDR, if contract-violation handler is not replaceable — end example]

G.3.9[ifndr:class.member.lookup.name.refers.diff.decl]
Specified in: [class.member.lookup]

A name N used in a class S referring to a different declaration when resolved in its context than when re-evaluated in the completed scope of S is ill-formed, no diagnostic required.
[Example 1: struct foo {}; struct bar { foo *m_foo; foo *foo() { return m_foo; } // IFNDR, foo now refers to member function foo() while previously referred to struct foo }; — end example]
[Example 2: struct B { static int f(); }; struct D : public B { using B::f; int g(decltype(f()) x) { return 0; } // IFNDR, decltype(f()) will refer to B​::​f() here but if // moved to the end of D it would refer to D​::​f() static float f(); }; int main() { D d; return d.g(0); } — end example]