This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug-Report egcs-1.1.1
- To: egcs-bugs at cygnus dot com
- Subject: Bug-Report egcs-1.1.1
- From: Joerg Rambau <rambau at zib dot de>
- Date: Thu, 11 Feb 1999 15:35:34 +0100 (MET)
- Reply-To: rambau at zib dot de
Hi,
below you find a bug report concerning template instantiation in egcs-1.1.1.
Please, tell me whether this is going to be fixed because egcs-1.1.1
breaks a larger project that compiles well under both egcs-1.0.2 and
gcc-2.8.1.
Regards,
Jörg Rambau
* System Information:
Manufacturer is Sun (Sun Microsystems)
System Model is Ultra 5/10
Main Memory is 128 MB
ROM Version is OBP 3.11.9 1998/03/06 10:31
Number of CPUs is 1
CPU Type is sparc
App Architecture is sparc
Kernel Architecture is sun4u
OS Name is SunOS
OS Version is 5.6
Kernel Version is SunOS Release 5.6 Version Generic_105181-10 [UNIX(R) System V Release 4.0]
* Compiler Information:
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
* Bug Description:
Compiler tries to instantiate a template with the wrong template
parameter (one that is never requested to be instantiated)
when nested classes are used in conjunction with a `typename'
declaration.
* Example input (typename_test.cc), stripped from a larger project:
template<class HashData>
class PlainHashTable {
private:
class entry {}; // <------------
public:
typedef typename HashData::const_keyptr_type const_keyptr_type; // <------------
};
template<class Key, class Data>
class HashMapData {
public:
typedef const Key* const_keyptr_type;
};
template<class Key, class Data>
class PlainHashMap : public PlainHashTable< HashMapData<Key, Data> > {
};
template<class Key, class T>
class HashMap {
private:
const PlainHashTable< HashMapData<Key, T> >::entry** _data; // <------------
};
void main() {
HashMap<int, char> it;
}
// eof
* Command Line and Output:
<5> g++ typename_test.cc
typename_test.cc: In instantiation of `PlainHashTable<int>':
typename_test.cc:26: instantiated from `HashMap<int,char>'
typename_test.cc:26: instantiated from here
typename_test.cc:26: no type named `const_keyptr_type' in `int'
* Further Remarks:
1) Commenting out the typename declaration in class PlainHashTable
or the declaration using the internal entry class of PlainHashTable in
HashMap or both makes the error go away.
2) Error occurs exactly the same way on egcs-1.1.1 on LinuxPPC R4.
--
Jörg Rambau ____ ___ Konrad Zuse Zentrum für Informationstechnik Berlin
____________// //// // Takustraße 7, D-14195 Berlin-Dahlem, GERMANY
_ ////_/ *Phone: +49-30 841 85-249 *Fax: -269
\\_//// \\_____________________________________rambau@zib.de