On 19/09/2018 11:26, Steven Watanabe wrote:
On 09/18/2018 05:17 PM, Gavin Lambert wrote:
Steven's already addressed this as well, which seems to agree. Although I must admit a little surprise; I thought I remembered that even though the actual initialisation of members occurs in the defined order, evaluation of arguments to the initialisers might not be. Perhaps this was something tightened in C++11?
It was always that way:
"There is a sequence point (1.9) after the initialization of each base and member. The expression-list of a mem-initializer is evaluated as part of the initialization of the corresponding base or member." [C++03]
Correct me if I'm wrong, but that text does not appear in C++98. So it's not quite "always". :) Although C++98 does still require that base constructors are called first [class.base.init#5] and that it is legal to call instance methods in the initialisers for members (but not legal in the base constructor call itself) [class.base.init#8]. So that part has probably always been safe.