Imagine this C++ code (which uses clang’s blocks language extension).
auto now = std::chrono::system_clock::now();
std::async(^ {
auto time = now;
// ...
});
What will be the type of time? Will it be decltype(now) or decltype(now)&? If it’s the latter, how can I make sure it’s copied before the block runs?
The object is copied, and its type is
decltype(now), as per the block language specification.