gcc-bug: gcc reports error in valid code (STL-related)
Mumit Khan
khan@NanoTech.Wisc.EDU
Fri Dec 31 20:54:00 GMT 1999
"A. Hirche" <hirche@informatik.uni-essen.de> writes:
>
> #include <list>
using namespace std; // you'll need this when C++ library is fixed.
>
> template <class T> class A : protected list<T*>
> {
public:
typedef typename list<T*>::iterator iterator;
typedef typename list<T*>::reverse_iterator reverse_iterator;
> public:
> A (void) { /* empty */ }
> ~A (void) { /* empty */ }
>
> void f (double p)
> {
> iterator i = begin(); // o.k.
> reverse_iterator j = rbegin(); // test.cpp:12: parse error before `='
> list<T*>::reverse_iterator k = rbegin(); // o.k.
^^^^^^^
typename list<T*>::reverse_iterator k = rbegin(); // o.k.
> }
> };
>
dependent type lookups and all. It should also complain about iterator
(line 11), but gcc-2.95.2 needs -pedantic before it'll complain there.
Also, line 13 requires a typename as well, and gcc-2.96 will give the
right diagnostic.
Regards,
Mumit
More information about the Gcc-bugs
mailing list