https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70792
Bug ID: 70792 Summary: Incorrect sequence point warning with uniform initializer syntax Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lefticus at gmail dot com Target Milestone: --- The following code: #include <utility> struct Do_Call { template<typename Func, typename ... T> Do_Call(const Func &f, T && ... t) { f(std::forward<T>(t)...); } }; int main() { const auto sum = [](int w, int x, int y, int z) { return w + x + y + z; }; int i = 0; Do_Call{sum, ++i, ++i, ++i, ++i}; } Generates the -Wsequence-point warning for the variable 'i'. However, the standard states: "Within the initializer-list of a braced-init-list, the initializer-clauses, including any that result from pack expansions (14.5.3), are evaluated in the order in which they appear. That is, every value computation and side effect associated with a given initializer-clause is sequenced before every value computation and side effect associated with any initializer-clause that follows it in the comma-separated list of the initializer-list. [Note: This evaluation ordering holds regardless of the semantics of the initialization; for example, it applies when the elements of the initializer-list are interpreted as arguments of a constructor call, even though ordinarily there are no sequencing constraints on the arguments of a call. —end note ]" The "Note: This evaluation ordering holds regardless of the semantics of the initialization; for example, it applies when the elements of the initializer-list are interpreted as arguments of a constructor call, even though ordinarily there are no sequencing constraints on the arguments of a call. —end note" is the most applicable to this bug report. This occurs in all versions tested between 4.7.3->6