This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15998] New: typo for std::mem_fun1 in include file stl_function.h


Here is the output from gcc -v:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3/specs
Configured with: ../configure --disable-nls --with-as=/usr/ccs/bin/as 
--with-ld=/usr/ccs/bin/ld
Thread model: posix
gcc version 3.3

I'm using gcc 3.3 and 3.3.2 on Sun's OS 5.6 and 5.8. While perusing the 
directory structure I noticed that there were two separate include directories 
with Standard Template Library files:

/usr/local/include/c++/3.3.2/bits
/usr/local/include/g++

I'm fairly certain that the compiler is using the first directory, due to the 
typo I found and the fact that I am unable to use std::mem_fun1. My code is 
essentially as follows

#include <functional>

class Apple
{
	public:
	void Aggregate(int)
};

void foo(const std::vector<Apple*>& apples)
{
	int n = 5;
	std::for_each( apples.begin(), apples.end(), 
std::bind2nd(std::mem_fun1<void, Apple, int>(&Apple::Aggregate), 5) );
}

The error reported is "'mem_fun1' undecalred in namespace 'std'"

In the file c++/3.3.2/bits/stl_function.h the function incorrectly reads 

template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }

The 1 was forgotten on the second line. The const version is also incorrect.

whereas in g++/stl_function.h the function correctly reads

template <class S, class T, class A>
inline mem_fun1_t<S,T,A> mem_fun1(S (T::*f)(A) {
	return mem_fun1_t<S,T,A>(f);
}

-- 
           Summary: typo for std::mem_fun1 in include file stl_function.h
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matthew dot j dot polder at kodak dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15998


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]