[libcxx-commits] [PATCH] D62228: Make `vector` unconditionally move elements when exceptions are disabled.

Jordan Rupprecht via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 4 18:51:46 PDT 2019


phab seems to have combined it w/ the next line, chop off the
"gcc/libstdc++" part. The fixed link is: https://godbolt.org/z/ct2GIe

In case it still doesn't work, the repro is:

#include <vector>

class CopyOnly {
public:
  CopyOnly() {}

  CopyOnly(CopyOnly&&) = delete;
  CopyOnly& operator=(CopyOnly&&) = delete;

  CopyOnly(const CopyOnly&) = default;
  CopyOnly& operator=(const CopyOnly&) = default;
};

void foo() {
    std::vector<CopyOnly> x;
    x.emplace_back();  // <-- this is broken for -stdlib=libc++
-fno-exceptions (but works w/ -stdlib=libc++, or works w/ gcc, etc.)

    CopyOnly c;
    x.push_back(c);  // <-- this is broken
}


On Wed, Sep 4, 2019 at 6:40 PM David Blaikie via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Godbolt link seems to be broken? Could you double-check it?
>
> On Wed, Sep 4, 2019 at 5:09 PM Jordan Rupprecht via Phabricator via
> llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
>> rupprecht added a comment.
>>
>> It looks like this breaks uses of `std::vector` with classes that are
>> copy only (moves disabled): https://godbolt.org/z/ct2GIe
>> gcc/libstdc++ <https://godbolt.org/z/ct2GIegcc/libstdc++> or
>> clang/libc++ w/ exceptions enabled both support it.
>>
>> Is this breakage intentional?
>>
>>
>> Repository:
>>   rL LLVM
>>
>> CHANGES SINCE LAST ACTION
>>   https://reviews.llvm.org/D62228/new/
>>
>> https://reviews.llvm.org/D62228
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190904/04f40eae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4849 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190904/04f40eae/attachment-0001.bin>


More information about the libcxx-commits mailing list