[cfe-users] bug in libc++

Manu monamimani at gmail.com
Thu Oct 3 14:58:29 PDT 2013


I thought that std::vector would have a noexcept move constructor and
assignment given that all of it's member are noexcept in regard of move
construction and assignment. Then again, i forgot about the allocator. But
that mean that the default allocator is not noexcept when doing a move
construction of assignment?

When we do a move construction or assignment of a vector with the default
allocator, there shouldn't be any actual heap allocation going on. no?

Also if it now crash thats is new. I am synched from about 3 days ago and
it was compiling with error but not crashing.

Thanks alot!


On Wed, Oct 2, 2013 at 11:22 PM, Steve Ramsey <clang at lucena.com> wrote:

> On Oct 2, 2013, at 4:56 PM, Manu <monamimani at gmail.com> wrote:
> > Hi this simple code is causing compilation error.
> > class Foo
> > {
> > public:
> >
> >   Foo(Foo&&) noexcept = default;
> >   Foo& operator=(Foo&&) noexcept = default;
> >
> >   Foo()
> >   {
> >   }
> >
> > private:
> >
> >   std::vector<std::string> vectorFoo_;
> > };
> >
> > see errors here
> > http://coliru.stacked-crooked.com/a/ab2fb522c4982c72
> >
> > But if I use libstdc++ it compile fine. So where is the bug libc++ or
> libstdc++?
>
> Didn’t check your link or try your code, but this might be because
> std::vector doesn’t have a nothrow move constructor or a nothrow
> move-assignment operator.
>
>                         Steve
>
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20131003/ab3c7fe1/attachment.html>


More information about the cfe-users mailing list