Are there sequence points in braced initializer lists when they apply to constructors?

前端 未结 2 646
青春惊慌失措
青春惊慌失措 2020-12-10 01:31

According to the n4296 C++ standard document:

[dcl.init.list] (8.5.4.4) (pg223-224)

Within the initializer-list of a braced-init-list, the

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 02:18

    The answer seems to be that yes, this is a bug in both GCC and MSVC.

    This is the status of this issue:

    1. There are several bugs against GCC regarding init-list rules. Most of them have gone completely unacknowledged by the GCC team. This at least implies that G++ does have bugs here because the issues have not been closed as invalid
    2. I have received unofficial word from the MSVC compiler team that this is in fact a bug in their compiler and they are working internally to fix it. However, I have no external bug to point to. As of MSVC 2015 Update 3, the old behavior remains.
    3. Clang, which at this point is by far the most pedantic standards-complaint compiler, implements it the way the standard seems to read.

    My personal investigation, discussions with C++ experts at conferences, and unofficial answers I've received from compiler developers indicates that this is a bug in MSVC and GCC, but I'm always reluctant to answer my own questions on StackOverflow. But here we are.

提交回复
热议问题