comeau reports no error, and with stlport5 testcase works fine. $ g++ -I/usr/include/stlport main.cpp -o main -lstlport && ./main Hello 1 Hello 2
with libstdc++ i get: $ g++ main.cpp -o main && ./main /usr/include/c++/4.1.2/bits/stl_function.h: In instantiation of ‘std::binder2nd<std::pointer_to_binary_function<int, const std::string&, void> >’: main.cpp:13: instantiated from here /usr/include/c++/4.1.2/bits/stl_function.h:435: error: forming reference to reference type ‘const std::string&’ /usr/include/c++/4.1.2/bits/stl_function.h: In function ‘std::binder2nd<_Operation> std::bind2nd(const _Operation&, const _Tp&) [with _Operation = std::pointer_to_binary_function<int, const std::string&, void>, _Tp = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’: main.cpp:13: instantiated from here /usr/include/c++/4.1.2/bits/stl_function.h:455: error: no matching function for call to ‘std::binder2nd<std::pointer_to_binary_function<int, const std::string&, void> >::binder2nd(const std::pointer_to_binary_function<int, const std::string&, void>&, const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)’ /usr/include/c++/4.1.2/bits/stl_function.h:429: note: candidates are: std::binder2nd<std::pointer_to_binary_function<int, const std::string&, void> >::binder2nd(const std::binder2nd<std::pointer_to_binary_function<int, const std::string&, void> >&) -- Summary: [reject-valid] error: forming reference to reference type X. Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29515