http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48507
Summary: Functor Declared In Templated Method Not Recognized By std::sort Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: oversee...@gmail.com Created attachment 23921 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23921 Source code (19 lines long) > g++ -v COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/tools/gcc/4.5.2/linux64/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ./configure --prefix=/tools/gcc/4.5.2/linux64 --with-gmp=/build/swbuild/tools/gmp/4.3.2/linux64 --with-mpfr=/build/swbuild/tools/mpfr/3.0.0/linux64 --with-mpc=/build/swbuild/tools/mpc/0.8.2/linux64 --enable-languages=c,c++ --with-binutils=/tools/binutils/2.18.50/linux64 Thread model: posix gcc version 4.5.2 (GCC) > g++ test.cpp test.cpp: In member function ‘void A::fn(const _Pr&) [with _Pr = LT]’: test.cpp:18:51: instantiated from here test.cpp:15:4: error: no matching function for call to ‘sort(std::vector<int>::iterator, std::vector<int>::iterator, A::fn(const _Pr&) [with _Pr = LT]::sub_pred)’ Although I'm not enough of an expert on the STL implementation to determine whether this program is legal, I do know that this program compiles using the MSVC implementation of STL.