[dcl.fct.def.replace]

# 9 Declarations [[dcl]](./#dcl)

## 9.6 Function definitions [[dcl.fct.def]](dcl.fct.def#replace)

### 9.6.5 Replaceable function definitions [dcl.fct.def.replace]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/declarations.tex#L7538)

Certain functions
for which a definition is supplied by the implementation
are [*replaceable*](#def:function,replaceable "9.6.5 Replaceable function definitions [dcl.fct.def.replace]")[.](#1.sentence-1)

A C++ program may
provide a definition with the signature of a replaceable function,
called a [*replacement function*](#def:function,replacement "9.6.5 Replaceable function definitions [dcl.fct.def.replace]")[.](#1.sentence-2)

The replacement function
is used instead of the default version
supplied by the implementation[.](#1.sentence-3)

Such replacement occurs
prior to program startup ([[basic.def.odr]](basic.def.odr "6.3 One-definition rule"), [[basic.start]](basic.start "6.10.3 Start and termination"))[.](#1.sentence-4)

A declaration of the replacement function

- [(1.1)](#1.1)

shall not be inline,

- [(1.2)](#1.2)

shall be attached to the global module,

- [(1.3)](#1.3)

shall have C++ language linkage,

- [(1.4)](#1.4)

shall have the same return type as the replaceable function, and

- [(1.5)](#1.5)

if the function is declared in a standard library header,
shall be such that it would be valid as a redeclaration
of the declaration in that header;

no diagnostic is required[.](#1.sentence-5)

[*Note [1](#note-1)*:

The one-definition rule ([[basic.def.odr]](basic.def.odr "6.3 One-definition rule"))
applies to the definitions of a replaceable function
provided by the program[.](#1.sentence-6)

The implementation-supplied function definition
is an otherwise-unnamed function with no linkage[.](#1.sentence-7)

â *end note*]
