:
inline void f(bool cond, void (*p)()) {
if (cond) f(false, []{});
}
inline void g(bool cond, void (*p)() = []{}) {
if (cond) g(false);
}
struct X {
void h(bool cond, void (*p)() = []{}) {
if (cond) h(false);
}
};
If the definition of
f appears in multiple translation units,
the behavior of the program is as if
there is only one definition of
f. If the definition of
g appears in multiple translation units,
the program is ill-formed (no diagnostic required) because
each such definition uses a default argument that
refers to a distinct
lambda-expression closure type
. The definition of
X can appear
in multiple translation units of a valid program;
the
lambda-expressions defined within
the default argument of
X::h within the definition of
X
denote the same closure type in each translation unit
. —
end example