freepooma-devel
[Top][All Lists]
Advanced

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

Compilation problem with gcc-3.0


From: Dave Nystrom
Subject: Compilation problem with gcc-3.0
Date: Wed, 27 Jun 2001 13:55:14 -0600
User-agent: SEMI/1.13.7 (Awazu) CLIME/1.13.6 (中 ノ庄) MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386-redhat-linux)

Below is a small test case that includes two functions, find1 and find2.
When I try to compile this with the g++ from gcc-3.0, I get the following
error:

saltydog % make
g++ -c -o tUnwrapKernel.o tUnwrapKernel.cc
tUnwrapKernel.cc: In member function `void X<C>::find2(Ptr<AnyType>)':
tUnwrapKernel.cc:33: parse error before `;' token
make: *** [tUnwrapKernel.o] Error 1

The construct in the find2 function, i.e.
"C* pClass( unwrap<C*>()(*object) );" is ubiquitous in our TecFramework
library package.  John Hall and I experimented last night with various
attempts to eliminate the error by using typename, etc.  The only solution we
found was to replace this construct with the two line construct that is in
the find1 function.  The original construct compiles just fine with KCC-4.0
using --strict.  Is the failure to compile a problem with gcc-3.0 or is KCC
taking liberties that it should not.  If there is a problem with gcc, would
it be possible to get a fix anytime soon.  We would like to get our code up
and running with gcc but making this change in so many places in our source
code base would be tedious and undesirable if there is really a problem with
gcc.  Also, we do not really own TecFramework and making these changes would
require negotiation with other people - this is not really that big of a deal
but we would just as soon avoid it if possible.

Thanks,

Dave Nystrom                    email: address@hidden
LANL X-3                        phone: 505-667-7913     fax: 505-665-3046

--------------------------------test.cc---------------------------------------
class AnyType
{};

template<class T>
class Ptr
{
  public:
    Ptr( T* inT ) : t(inT) {}
    T* operator*() { return t; }

  private:
    T* t;
};

template<class T>
struct unwrap
{
    Ptr<AnyType> operator()( T& ) {}
};

template<class C>
class X
{
  public:
    void find1( Ptr<AnyType> object )
    {
        unwrap<C*> myUnwrap;
        C* pClass( myUnwrap(*object));
    }

    void find2( Ptr<AnyType> object )
    {
        C* pClass( unwrap<C*>()(*object));
    }
};

reply via email to

[Prev in Thread] Current Thread [Next in Thread]