This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++: Fail to find function (constructor)
- To: ulf dot larsson at mbox337 dot swipnet dot se
- Subject: Re: g++: Fail to find function (constructor)
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 17 Mar 2000 06:53:42 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38D1C6B1.B908D7D6@mbox337.swipnet.se>
> g++ don't accept this code which I think is correct (for example it
> works if I replace std::string with char*).
Thanks for your bug report. Please read the error messages carefully;
your code is clearly ill-formed.
The bind2nd function instantiates the binder2nd template, which has a
constructor of
binder2nd(const Operation& x,
const typename Operation::second_argument_type& y);
according to 20.3.6.3. Operation in this case is a mem_fun1_t, where
the argument type is "const string&", which becomes
Operation::second_argument. Therefore, the binder2nd constructor
receives a 'string const& const&', i.e. a reference to
reference. Having references to references is not allowed in C++,
hence the error.
If you question this line of reasoning, please discuss it in one of
the public C++ fora first, eg. comp.lang.c++.moderated, or
comp.std.c++.
Regards,
Martin