egcs-1.0: template dependent type bug?

Helge Schulz helge@sdm.de
Mon Dec 8 12:51:00 GMT 1997


Why compiles this program with gcc-2.7.2.1 and not with egcs-1.0 (2.90.21)?

$ cat deptempl.cc

/*
 * deptempl.cc
 *
 * compiles with gcc-2.7.2.1, not with egcs-1.0 (2.90.21)
 *
 * Helge.Schulz@sdm.de
 */

template <class Type> struct Template {
  typename Type::T i;
};

struct User {
  typedef int T;
  typedef Template<User> TU;
  TU o;
};

int main() {
  User u;
  u.o.i = 1;
}

$ /usr/bin/gcc -v

Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.1/specs
gcc version 2.7.2.1

$ /usr/bin/gcc deptempl.cc

$ /opt/egcs/bin/gcc -v

Reading specs from /opt/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.21/specs
gcc version egcs-2.90.21 971202 (egcs-1.00 release)

$ /opt/egcs/bin/gcc deptempl.cc

deptempl.cc:16: no type named `T' in `struct User'

Helge Schulz                     |s  |d &|m  |  software design & management
Helge.Schulz@sdm.de              |   |   |   |  GmbH & Co. KG
Tel/Fax (089) 63812-449/220      |   |   |   |  Thomas-Dehler-Str. 27
Helge.Schulz@lintos.m.isar.de     (privat)      81737 Muenchen
3CE27F2BE93DF37E 86D73FB258DC648A (PGP)



More information about the Gcc-bugs mailing list