This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11429] New: nested class within template class is not inherited by derived template class
- From: "pettit at mbi dot ucla dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jul 2003 05:50:06 -0000
- Subject: [Bug c++/11429] New: nested class within template class is not inherited by derived template class
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11429
Summary: nested class within template class is not inherited by
derived template class
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pettit at mbi dot ucla dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
Gcc 3.3 emits nonsensical "implicit typename" warnings whenever a derived
template class mentions a nested class that was declared within the
base template class; the nested class should be inherited by the derived
class, but is not inherited. Hence gcc regards any mention of the nested
class as an "implicit typename". Does not happend with Gcc 2.96, but
I remember it happening with earlier versions.
Here is a simple example (warning message listed below):
template < class T>
class base
{
public:
base( void) { }
~base( void) { }
class nested
{
public:
int i;
};
};
template < class T>
class derived : public base< T >
{
public:
derived( void) { }
~derived( void) { }
int transform( nested f1st, nested last) const;
};
template < class T>
int derived< T>::transform( derived< T>::nested f1st,
derived< T>::nested last) const
{ return f1st.i+last.i; }
int main( int argc, char **argv)
{
int j;
base<int> bob;
derived<int> mary;
derived<int>::nested f1st, last;
f1st.i = 2;
last.i = 2;
j = mary.transform( f1st, last);
}
template class base< int>;
template class derived< int>;
Here is the warning message from GCC:
junk.cpp:20: warning: `derived<T>::nested' is implicitly a typename
junk.cpp:20: warning: implicit typename is deprecated, please see the
documentation for details
junk.cpp:20: warning: `derived<T>::nested' is implicitly a typename
junk.cpp:20: warning: implicit typename is deprecated, please see the
documentation for details
junk.cpp:26: warning: `derived<T>::nested' is implicitly a typename
junk.cpp:26: warning: implicit typename is deprecated, please see the
documentation for details
junk.cpp:26: warning: `derived<T>::nested' is implicitly a typename
junk.cpp:26: warning: implicit typename is deprecated, please see the
documentation for details
Gcc was configured with these options:
Configured with: ../gcc-3.3/configure --with-stabs --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --enable-languages=c,c++,f77,java --enable-threads=posix
Thread model: posix
gcc version 3.3
Output of uname -a:
Linux 2.4.3-20mdk #1 Sun Apr 15 23:03:10 CEST 2001 i686 unknown