Re: Re: [sigc] libsigc++ 1.9.13 fails on Solaris 9 sparc



On Mon, 2004-03-22 at 20:18, martin-ml hippogriff de wrote:
> Am 22.03.2004 um 14:12 Uhr haben Sie geschrieben:
> > On Mon, 2004-03-22 at 13:56, Damien Carbery wrote:
> > > Worse.
> > > Line is now:
> > >    thing_.template operator()<int>(1, 2);
> > > 
> > > line 20: Error: A class template name was expected instead of
> operator.
> > > line 20: Error: Badly formed expression.
> > > 
> > > with:
> > >   thing_.T operator()<int>(1, 2);
> > > line 20: Error: operator() is not defined.
> > > line 20: Error: Badly formed expression.
> > 
> > Martin, do you think there is any way to keep the operator() in the
> API,
> > but use a normal callit() method internally?
> 
> Well, there doesn't seem to be a way around it.

I'm not sure if that means "Yes, we must do that", or "No, that won't
work". The attached workaround test works with SUN Forte C+ 5.4. Unless
you are doing this yourself, I will try to implement this.

-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com
#include <iostream>

class Thing
{
public:
  Thing()
    {}

  template <class T>
  void workaround_operator_bracket(T a, T b)
  {
    operator()(a, b);
  }

  template <class T>
  void operator()(T a, T b)
  {
    T c = a + b;
    std::cout << c << std::endl;
  }
};

int main(int, char*[])
{
  Thing thing_;

  // Either with or without the template keyword here (which should work and should maybe be required),
  // this fails with Forte C++ 5.3, 5.4, and 5.5:
  // It succeeds with gcc 3.2 (with or without the template keyword) and cvs versions of gcc 3.4 (with the template keyword),
  // and it succeeds with MSVC++ (without the template keyword).
  thing_.template workaround_operator_bracket<int>(1, 2);
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]