Local reference to std::cout captured by lambda without asking for it
Have I lost my mind? Was this always permitted? #include <iostream> int main() { auto& os = std::cout; auto write = []() { os << "what\n"; }; write(); } I'm using: Apple LLVM version 10.0.0 (clang-1000.10.44.4) Target: x86_64-apple-darwin17.7.0 Though also see on Coliru: ( live demo ) I always thought an empty capture would not capture anything. Indeed, MSDN says : An empty capture clause, [ ], indicates that the body of the lambda expression accesses no variables in the enclosing scope. Further research suggests that this is in fact okay for capturing const things (which I also didn't know,