Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

about 6 years ago

Language

C++

Compiler

gcc 7.3.0

Options
Warnings
Optimization
Don't Use Boost
C++11
no pedantic

Author

anonymous

about 6 years ago

$ g++ prog.cc -Wall -Wextra -O2 -march=native -std=c++11
prog.cc: In member function 'void Baz::foo()':
prog.cc:5:21: error: capture of non-variable 'Baz::s' 
         auto lam = [s]() { std::cout << s; };
                     ^
prog.cc:9:17: note: 'std::__cxx11::string Baz::s' declared here
     std::string s;
                 ^
prog.cc: In lambda function:
prog.cc:5:41: error: 'this' was not captured for this lambda function
         auto lam = [s]() { std::cout << s; };
                                         ^
prog.cc:5:41: error: invalid use of non-static data member 'Baz::s'
prog.cc:9:17: note: declared here
     std::string s;
                 ^
Exit Code:
1