Before I return to working on generic lambdas, I thought it might be useful to nail down DR 712 which reworded the definition of odr-use in terms of the potential results of an expression (in order to avoid odr-using a variable that represents a constant expression whenever we can get away with it). This is relevant to lambdas, because it affects which variables get captured and which don’t.

Before I return to working on generic lambdas, I thought it might be useful to nail down DR 712 which reworded the definition of odr-use in terms of the potential results of an expression (in order to avoid odr-using a variable that represents a constant expression whenever we can get away with it). This is relevant to lambdas, because it affects which variables get captured and which don’t.

This seems like the right approach, although you presumably don’t actually need to build the vector and could just remove the odr-use marker directly.

No. Here, e = ‘s.mi’, ex = ‘s’ (a member of the set of potential results of e), and e is subject to an lvalue-to-rvalue conversion.

Also no, because an lvalue-to-rvalue conversion is applied to s.mi.

Also no, because this is a discarded-value expression.

Also no.

Also no.

Note that member function calls aren’t listed in the rules of 3.2/2. ‘s’ is not in the set of potential results of ‘s.operator int()’.

The rule says: “x […] is odr-used unless […] ex is is an element of the set of potential results of an expression e, where […]”

That is, if there *exists* such an ‘e’, then ‘x’ is not odr-used.

Hope that helps!