GCC 3.4 parser bug?

Craig Rodrigues rodrigc@attbi.com
Sun Jan 19 05:10:00 GMT 2003


Hi,

The attached testcase compiles fine with GCC 3.2, and 3.3-branch.

However with GCC 3.4 20030117 (experimental), I get:

R1.cpp: In instantiation of `ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>':
R1.cpp:53:   instantiated from here
R1.cpp:26: error: `ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::lock_' has 
   incomplete type
R1.cpp:26: error: invalid use of template type parameter

Is this ill-formed code, or a parser bug?
-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com
-------------- next part --------------
template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr_Rep;
template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr;

template <class X, class ACE_LOCK>
class ACE_Refcounted_Auto_Ptr
{
public:

  ACE_Refcounted_Auto_Ptr (X *p = 0);
  ACE_Refcounted_Auto_Ptr (const ACE_Refcounted_Auto_Ptr<X, ACE_LOCK> &r);
  virtual ~ACE_Refcounted_Auto_Ptr (void);

protected:

  typedef ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> AUTO_REFCOUNTED_PTR_REP;
  AUTO_REFCOUNTED_PTR_REP *rep_;
};

template <class X, class ACE_LOCK>
class ACE_Refcounted_Auto_Ptr_Rep
{
private:
  friend class ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>;

  static void detach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *&rep);
  ACE_LOCK lock_;

private:

  ACE_Refcounted_Auto_Ptr_Rep (X *p = 0);
  ~ACE_Refcounted_Auto_Ptr_Rep (void);
};

template <class X, class ACE_LOCK> inline void
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::detach (ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>*& rep)
{
  ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *rep_del = 0;
}

template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::ACE_Refcounted_Auto_Ptr_Rep (X *p)
{
}

template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr_Rep (void)
{
}

template <class X, class ACE_LOCK> inline
ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr (void)
{
  AUTO_REFCOUNTED_PTR_REP::detach (rep_);
}

int main(int , char *[])
{
        return 0;
}


More information about the Gcc mailing list