Bug 12068 - Template class definition generates error
Summary: Template class definition generates error
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 2.96 (redhat)
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-26 15:11 UTC by Menita
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Menita 2003-08-26 15:11:57 UTC
I get a compile error "Internal Error: Segmentation Fault", at this line, where 
i define:

template<class ValueType> class ArrayListImpl<ValueType>::Itr : public 
Iterator<ValueType> {

}
Previoulsy i define:
template<class ValueType> class ArrayListImpl : public List<ValueType>::Impl{
private class Impl;
.....[other stuff]
}
Comment 1 Andrew Pinski 2003-08-26 15:37:11 UTC
Read <http://gcc.gnu.org/bugs.html>, we do not want just a snip of your code.
Comment 2 Menita 2003-08-26 15:40:35 UTC
correction

I get a compile error "Internal Error: Segmentation Fault", at this line, where 
i define:

template<class ValueType> class ArrayListImpl<ValueType>::Itr : public 
Iterator<ValueType> {

}
Previoulsy i define:
template<class ValueType> class ArrayListImpl : public List<ValueType>::Impl{
private class Itr;
.....[other stuff]
}

Comment 3 Wolfgang Bangerth 2003-08-26 15:54:24 UTC
That's not what Andrew meant. We need a complete testcase which we can try 
to compile. Leaving out stuff with "//...more stuff" is not sufficient. Please read the 
page Andrew pointed you to to see what kind of information we need (read the 
section on preprocessed sources). 
 
Thanks 
  Wolfgang 
Comment 4 Menita 2003-08-26 17:49:50 UTC
template<class ValueType = Object> class ArrayListImpl : public 
List<ValueType>::Impl {

   private: class Itr;
   private: Array<ValueType> elemData;
   private: _index numElems; 

     protected: static _index DEFAULT_CAPACITY; //LINUX
     public: ArrayListImpl( _index pInitialCapacity =DEFAULT_CAPACITY );
     public: ArrayListImpl( const ArrayListImpl& pAnother ); 
     public: ArrayListImpl& operator =( const ArrayListImpl& pAnother );
friend class Itr;
};

/******************I GET AN ERROR IN THE FOLLOWING LINE#: *****/
template<class ValueType> class ArrayListImpl<ValueType>::Itr : public 
Iterator<ValueType> {

   private: class Impl : public Iterator<ValueType>::Impl {
      protected: ArrayListImpl<ValueType>& base;
      private: index cursor;
      private: int lastRet;
      private: boolean canRemove;
      protected: Impl( ArrayListImpl<ValueType>& pBase );
      protected: Impl( const ArrayListImpl<ValueType>& pBase );
      protected: Impl( const Impl& pAnother );
      protected: ~Impl();
      private: Impl& operator =( const Impl& pAnother );
      friend class Itr;
   };
   public: Itr( Impl* pImpl );
};





Comment 5 Andrew Pinski 2003-08-26 17:57:27 UTC
You still are not getting the point the code you gave will not work on any compiler as where is List 
defined and other classes.
From http://gcc.gnu.org/bugs:
What we need (all of these are needed)
Please include in your bug report all of the following items, the first three of which can be obtained 
from the output of gcc -v:
the exact version of GCC;
the system type;
the options given when GCC was configured/built;
the complete command line that triggers the bug;
the compiler output (error messages, warnings, etc.); and
the preprocessed file (*.i*) that triggers the   bug, generated by adding -save-temps to the 
complete   compilation command, or, in the case of a bug report for the GNAT front end,   a 
complete set of source files (see below).

What we do not want:(this is what you gave us so far.)
A code snippet that won't cause the compiler to produce the   exact output mentioned in the bug 
report (e.g., a snippet with just   a few lines around the one that apparently triggers the bug,   with 
some pieces replaced with ellipses or comments for extra   obfuscation :-)
Bugs in releases or snapshots of GCC not issued by the GNU   Project.  Report them to whoever 
provided you with the release
Comment 6 Andrew Pinski 2003-09-28 21:28:13 UTC
2.96 is a non-supported version, also there has been many releases since 2000. 3.3.1 is 
the lastest, 3.3.2 will be released next month.
Closing as there is no way to reproduce this without a testcase but I would try a newer 
GCC first any way.