BillyONeal added subscribers: STL_MSFT, BillyONeal.
BillyONeal added a comment.

@mclow.lists
@STL_MSFT

Why did tests for this this go into std? [reentrancy]/1 says this isn't 
required to work. Moreover, assignments in the dtor like this *can't* work in 
the general case because they would try to overwrite the SSO space. e.g. what 
do you expect this to do?

  std::function<void()> global;
  
  struct B {
      int data = 1729;
      void operator() {}
  };
  
  struct A {
      int data = 42;
      ~A() {
          global = std::function<void()>(B{}); // whoops, constructs a B on top 
of A if Small Functor Optimization engages
          assert(data == 42);
      }
  
      void operator() {}
  };
  
  int main() {
      global = std::function<void ()>(A{});
      global = nullptr;
  }




Repository:
  rCXX libc++

https://reviews.llvm.org/D34331



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

Reply via email to