Language
C++
Compiler
gcc 12.2.0
Options
Warnings
Optimization
Don't Use Boost
C++2a
-pedantic-errors
$ g++ prog.cc -Wall -Wextra -O2 -march=native -std=c++2a -pedantic-errors
Exit Code:
1
Author
anonymous
about 2 years ago
C++
gcc 12.2.0
Author
anonymous
about 2 years ago
$ g++ prog.cc -Wall -Wextra -O2 -march=native -std=c++2a -pedantic-errors
prog.cc: In function 'int main()':
prog.cc:9:13: error: call of overloaded 'for_each(std::vector<int>::iterator, std::vector<int>::iterator, main()::<lambda(int&)>)' is ambiguous
9 | for_each(vec.begin(), vec.end(), [](int &){});
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:5:6: note: candidate: 'void for_each(It, It, F) [with It = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; F = main()::<lambda(int&)>]'
5 | void for_each(It begin, It end, F f) {}
| ^~~~~~~~
In file included from /opt/wandbox/gcc-12.2.0/include/c++/12.2.0/algorithm:61,
from prog.cc:2:
/opt/wandbox/gcc-12.2.0/include/c++/12.2.0/bits/stl_algo.h:3781:5: note: candidate: 'constexpr _Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _Funct = main()::<lambda(int&)>]'
3781 | for_each(_InputIterator __first, _InputIterator __last, _Function __f)
| ^~~~~~~~