[PATCH] D99696: [clang] NRVO: Improvements and handling of more cases.

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 14 06:42:24 PDT 2021


hans added subscribers: rjmccall, hans.
hans added a comment.

We're seeing new build errors in Chromium after this (http://crbug.com/1219457). Here's a reduced example:

  $ cat /tmp/a.mm
  #include <utility>
  
  struct Callback {
    // Move-only!
    Callback(const Callback&) = delete;
    Callback& operator=(const Callback&) = delete;
    Callback(Callback&&) = default;
    Callback& operator=(Callback&&) = default;
  
    void operator()() {}
  };
  
  void f(Callback c) {
    __block auto x = std::move(c);
  
    (void)^(void) {
      x();
    };
  }
  
  $ build.release/bin/clang++ -c /tmp/a.mm -target x86_64-apple-darwin10 -stdlib=libc++
  /tmp/a.mm:14:16: error: call to deleted constructor of 'Callback'
    __block auto x = std::move(c);
                 ^
  /tmp/a.mm:5:3: note: 'Callback' has been explicitly marked deleted here
    Callback(const Callback&) = delete;
    ^
  1 error generated.

I don't know enough about blocks to know whether the new error makes sense or not.

+rjmccall who knows about blocks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99696



More information about the cfe-commits mailing list