Linux incomplete C++ stdlib

9 views
Skip to first unread message

Avi Drissman

unread,
Sep 29, 2016, 8:00:26 PM9/29/16
to cxx
In https://codereview.chromium.org/2379863002/#ps100001, some linux builds fail when I pass a const_iterator to vector::erase. That should be allowed in C++11 (and win/mac are OK with it) but linux is unhappy:

../../ui/base/models/tree_node_model.h:96:15: error: no matching member function for call to 'erase'
    children_.erase(i);
    ~~~~~~~~~~^~~~~
../../ui/base/models/tree_node_model_unittest.cc:276:39: note: in instantiation of member function 'ui::TreeNode<ui::TreeNodeWithValue<int> >::Remove' requested here
  std::unique_ptr<TestNode> c2 = root.Remove(child2);
                                      ^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stl_vector.h:986:7: note: candidate function not viable: no known conversion from '__normal_iterator<const std::unique_ptr<ui::TreeNodeWithValue<int>, std::default_delete<ui::TreeNodeWithValue<int> > > *, [...]>' to '__normal_iterator<pointer, [...]>' for 1st argument
      erase(iterator __position);
      ^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stl_vector.h:1007:7: note: candidate function not viable: requires 2 arguments, but 1 was provided
      erase(iterator __first, iterator __last);

:/ Wanted to keep you informed; will work around it.

Avi

Nico Weber

unread,
Sep 29, 2016, 8:04:46 PM9/29/16
to Avi Drissman, cxx

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To post to this group, send email to c...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACWgwAYJC5mUCo2GA2YvEySn85EZi9CjPq2-LkQfpCjpaMvHBw%40mail.gmail.com.

Avi Drissman

unread,
Sep 29, 2016, 8:08:35 PM9/29/16
to Nico Weber, cxx
Done.

Peter Kasting

unread,
Sep 30, 2016, 12:32:35 AM9/30/16
to Avi Drissman, cxx
On Thu, Sep 29, 2016 at 5:00 PM, 'Avi Drissman' via cxx <c...@chromium.org> wrote:
In https://codereview.chromium.org/2379863002/#ps100001, some linux builds fail when I pass a const_iterator to vector::erase. That should be allowed in C++11 (and win/mac are OK with it) but linux is unhappy:


"Irritatingly, it looks like libstdc++ 4.6 does not correctly support the C++11 specs for container erase() methods (which changed from iterator to const_iterator).  That was apparently fixed for libstdc++ 4.9.  I didn't check insert(), which changed similarly, so I don't know if that's broken too."

:(

PK
Reply all
Reply to author
Forward
0 new messages