Does the code below require f1 called before f2 (or vice versa) or is it not specified?
f1
f2
int f1(); int f2(); std::initializer_list<int> list { f1(), f2() };
This is one of the interesting corners of the C ++ standard where the order of execution is well defined. Section 8.5.4 [dcl.init.list], clause 4:
In the list initializers list with reference to initialization, initializer offers, including everything that is the result of packet decompositions (14.5.3), are evaluated in the order in which they are displayed. That is, the calculation of each value and the side effect associated with the given initializer clause are sequenced before each calculation of the value and the side effect associated with any initializer clause that follows it in the list of initializers separated by commas.
So, in the list of initializers, function calls are evaluated from left to right.