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]

Re: g++: Fail to find function (constructor)


> 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

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