This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
According to 6.3 [basic.def.odr] bullet 6.5,
in each definition of D, a default argument used by an (implicit or explicit) function call is treated as if its token sequence were present in the definition of D; that is, the default argument is subject to the requirements described in this paragraph (and, if the default argument has subexpressions with default arguments, this requirement applies recursively)
However, this rule is insufficient to handle a case like:
struct A { template<typename T> A(T); }; void f(A a = []{}); inline void g() { f(); }
This should be an ODR violation, because the call to f() will invoke a different specialization of the constructor template in each translation unit, but it is not, because the rule says this example is equivalent to:
inline void g() { f([]{}); }
which is not an ODR violation, since the type of the closure object will be the same in every translation unit (9.2.8 [dcl.inline] paragraph 6) ..
Notes from the October, 2018 teleconference:
This will be addressed by work already underway to rework the relationship between lambdas and the ODR.Rationale (February, 2021):
The resolution of issue 2300 makes clear that this example is an ODR violation.