[PATCH] D88220: [C++20] P1825R0: More implicit moves

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 19 08:25:15 PDT 2021


sberg added a comment.

This change causes

  #include <memory>
  std::shared_ptr<int> x1;
  std::shared_ptr<int> f() {
      std::shared_ptr<int> & r = x1;
      r.reset(new int);
      return r;
  }
  int main() {
      std::shared_ptr<int> x2 = f();
      long n = x2.use_count();
      return n;
  }

when built with `-std=c++20` to erroneously return a `use_count` of 1 instead of 2 now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88220



More information about the cfe-commits mailing list