jyknight added a comment.

This commit seems to have broken libc++ in C++98 mode, as it appears to have 
depended upon the implicit-move extension.

Reproduction is simple. Build this with `-stdlib=libc++ -std=c++98`:

  #include <set>
  void foo (std::set<int> *s) {
     s->insert(5);
  }

(https://godbolt.org/z/vKWKhE34x)

The root cause appears to be that libc++ emulates unique_ptr in c++98 mode, and 
this emulation stopped working. E.g. this no longer works (compiled with same 
flags):

  #include <memory>
  std::unique_ptr<int> foo() {
    std::unique_ptr<int> x;
    return x;
  }

To simplify further, removing the stdlib headers: returning a type with a move 
constructor but no copy constructor used to work, and now doesn't (with 
-std=c++98).

  struct uncopyable {
    uncopyable() = default;
    uncopyable(uncopyable const&) = delete;
    uncopyable(uncopyable&&) = default;
  };
  uncopyable bar() {
    uncopyable x;
    return x;
  }

Now, of course, the above is invalid c++98, because rvalue references aren't 
even a thing there...but clang _does_ implement rvalue references in c++98 
mode, and libc++ depends on it.

So -- I think either libc++ needs to stop depending on this nonstandard 
functionality, or we need to keep implementing it in Clang. I don't know which 
option would be more desirable.

CC+=ldionne, for libc++ expertise.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104500/new/

https://reviews.llvm.org/D104500

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to