egcs 1.0.3 template and typedef bug

Pavlos Papageorgiou pavlos.papageorgiou@voxar.com
Thu Oct 1 08:24:00 GMT 1998


It seems that egcs-1.0.3 does not support typedefs within classes
that are used as template parameters. It supports enums and other
members but not typedefs.

Sample code, version, and output follow.

===============================

class SimpleTraits {
public:
    typedef int Integer;
};

template <class Traits>
class Configurable {
public:
    int f () {
        Traits::Integer i = 3;
	return i;
    }
};

int main () {
    Configurable<SimpleTraits> c;
    return c.f();
}

===============================

g++ --version
egcs-2.90.29 980515 (egcs-1.0.3 release)

===============================

g++ egcs_bug.cpp
egcs_bug.cpp: In method `int Configurable<Traits>::f()':
egcs_bug.cpp:12: parse error before `='
egcs_bug.cpp: In method `int Configurable<SimpleTraits>::f()':
egcs_bug.cpp:13: `i' undeclared (first use this function)
egcs_bug.cpp:13: (Each undeclared identifier is reported only once
egcs_bug.cpp:13: for each function it appears in.)

===============================

Thank you
Pavlos Papageorgiou
Voxar Ltd
pavlos@voxar.com



More information about the Gcc-bugs mailing list