www.digitalmars.com         C & C++   DMDScript  

c++ - Error: need explicit cast for function parameter

reply "Alex Vinokur" <alexvn connect.to> writes:
=========================
Windows 2000 Professional
Digital Mars C/C++ 8.36
STLport 4.5.3
=========================

I have got a problem with compilation of the following piece of code
  using Digital Mars C/C++ compiler.

There was no problem with this code while using GNU g++ 3.2.

What is wrong?


====== C++ code : BEGIN ======

------ bar.h file : Fragment ------
class Foo
{
[---omitted---]

  public :
    bool foo (const Foo* const) const;

[---omitted---]
}
-----------------------------------


------ bar.cpp file : Fragment ------
[---omitted---]



[---omitted---]
-------------------------------------

====== C++ code : END ========


====== Compilation : BEGIN ======

$ sc -I. -I\dm\stlport\stlport -c bar.cpp
  mem_fun(&Foo::foo);

bar.cpp(255) : Error: need explicit cast for function parameter 1 to get
from: bool ( Foo::*member func)(const Foo*const )const
to  : bool ( Foo::*member func)(const Foo*)const
 mem_fun(&Foo::foo),

====== Compilation : END ========


   =====================================
   Alex Vinokur
     mailto:alexvn connect.to
     http://mathforum.org/library/view/10978.html
   =====================================
Sep 15 2003
parent Heinz Saathoff <hsaat bre.ipnet.de> writes:
Alex Vinokur schrieb...
 $ sc -I. -I\dm\stlport\stlport -c bar.cpp
   mem_fun(&Foo::foo);
 
 bar.cpp(255) : Error: need explicit cast for function parameter 1 to get
 from: bool ( Foo::*member func)(const Foo*const )const
 to  : bool ( Foo::*member func)(const Foo*)const
  mem_fun(&Foo::foo),
DMC still treats func(type t) and func(type t const) as different functions. This is already on Walters to do list. - Heinz
Sep 15 2003