I have a tricky C++ question: When you have a constructor initialization list with delegated constructors, what is the list execution order?
There exist two conflicting standard rules here:
1.) The constructor initialization list gets executed NOT by the list order but by the declaration order of the items.
2.) Delegated constructors in the constructor initialization list always get called before the “mother constructor” is executed.
Which rule is superior? (since a constructor is a class item too)
Why this is important: assume the delegated constructor re-inits an item already initialized by the “mother constructor” or vice versa.
§12.6.2/6 says
So there’s no conflict, since you can’t initialise anything before you delegate a constructor. Delegating a constructor simply calls that constructor, the target constructor’s initialiser list is run, the target constructor runs, and then the principal constructor runs.