https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117508

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
namespace std
{
  /// initializer_list
  template<class _E>
    class initializer_list
    {
    public:
      using size_type = decltype(sizeof(1));

    private:
      const _E*                 _M_array;
      size_type                 _M_len;

      // The compiler can call a private constructor.
      constexpr initializer_list(const _E* __a, size_type __l)
      : _M_array(__a), _M_len(__l) { }

    public:
      constexpr initializer_list() noexcept
      : _M_array(0), _M_len(0) { }

      // Number of elements.
      constexpr size_type
      size() const noexcept { return _M_len; }

      // First element.
      constexpr const _E*
      begin() const noexcept { return _M_array; }

      // One past the last element.
      constexpr const _E*
      end() const noexcept { return begin() + size(); }
    };
}

struct V {
  V(const char*) { }
  ~V() { }
};

struct X {
  X(std::initializer_list<V>) { }
};

void test01() {
  X x { {"E"}, {"E"}, {"T"}, {"T"} };
  return;
}

int main() {
  test01();
  return 0;
}


This only jumps to the closing brace once:

Temporary breakpoint 1, main () at 83709.cc:51
51        test01();
test01 () at 83709.cc:48
48      }
46        X x { {"E"}, {"E"}, {"T"}, {"T"} };
47        return;
48      }
Continuing.

Reply via email to