www.digitalmars.com         C & C++   DMDScript  

c++.beta - Problems with member templates

reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
I have some code which can be compiled fine with Borland, GCC, VC, Intel 
and CodeWarrior compilers but not in DMC. Digital Mars compiler either has 
problems with member templates, automatic type deduction in member 
templates or problems with member function pointers. Below is minimal code 
which fail in last official 8.38 and last beta of 8.39 relases of DMC:

  class POVMS_Message;
  class MessageReceiver
  {
    protected:
      template<class T> class HandlerOO
      {
        typedef void (T::*HandlerPtr)(POVMS_Message&, POVMS_Message&, int);
      };
      template<class T> class Handler
      {
        typedef void (T::*HandlerPtr)(void *, void *, int);
      };
      MessageReceiver(void *);
      template<class T>
        void InstallFront(T *cptr, typename HandlerOO<T>::HandlerPtr hptr)
        {
        }
      template<class T>
        void InstallFront(T *cptr, typename Handler<T>::HandlerPtr hptr)
        {
        }
  };

  class MessageOutput : public MessageReceiver
  {
    public:
      MessageOutput(void *);
      ~MessageOutput();
      void InitInfo(void *, void *, int);
  };

  MessageOutput::MessageOutput(void * context) : MessageReceiver(context)
  {
    InstallFront(this,  &MessageOutput::InitInfo);
  }



Error message is:


c:\dm\bin\dmc -cpp -c -o -Ae  ..\..\source\frontend\messageoutput.cpp
  InstallFront(this,  &MessageOutput::InitInfo);
                                              ^
..\..\source\frontend\messageoutput.cpp(38) : Error: ambiguous reference to
symbol
Had: MessageReceiver::InstallFront(T*,HandlerPtrHandlerOO<T>)
and: MessageReceiver::InstallFront(T*,HandlerPtrHandler<T>)

ABX
Dec 10 2003
parent reply Wlodzimierz Skiba <Wlodzimierz_member pathlink.com> writes:
In article <br792o$j5n$1 digitaldaemon.com>, W這dzimierz Skiba says...
 I have some code which can be compiled fine with Borland, GCC, VC, Intel 
 and CodeWarrior compilers but not in DMC.

Walter, any progress on this? How far the next beta or full release is? ABX
Jan 20 2004
parent reply "Walter" <walter digitalmars.com> writes:
I need a minimal example which reproduces the problem.

"Wlodzimierz Skiba" <Wlodzimierz_member pathlink.com> wrote in message
news:buji22$2tps$1 digitaldaemon.com...
 In article <br792o$j5n$1 digitaldaemon.com>, W這dzimierz Skiba says...
 I have some code which can be compiled fine with Borland, GCC, VC, Intel
 and CodeWarrior compilers but not in DMC.

Walter, any progress on this? How far the next beta or full release is? ABX

Jan 20 2004
parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
"Walter" <walter digitalmars.com> wrote in
news:bukd6f$180i$2 digitaldaemon.com: 
 I need a minimal example which reproduces the problem.

Is there anything wrong with minimal example posted at begining of this thread? See c++.beta/262 ABX
Jan 21 2004
parent "Walter" <walter digitalmars.com> writes:
"W這dzimierz Skiba" <abx abx.art.pl> wrote in message
news:bulk3v$3oq$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in
 news:bukd6f$180i$2 digitaldaemon.com:
 I need a minimal example which reproduces the problem.

Is there anything wrong with minimal example posted at begining of this thread? See c++.beta/262

Ah, no, it'll do fine. My mistake.
Jan 21 2004