Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Author

anonymous

over 6 years ago

Language

C++

Compiler

gcc 7.3.0

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

Author

anonymous

over 6 years ago

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