www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

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

↑ ↓ ← "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---]

  mem_fun(&Foo::foo); // Line#255

[---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
↑ ↓ → 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