Bug report
Karl JH Millar
kmillar@MIT.EDU
Thu Dec 10 12:43:00 GMT 1998
I get a compiler error compiling the following
template<class I, class J>
class Map {
public:
typedef I* iterator;
};
template<class T>
void foo(T a) {
Map<int, T>::iterator i;
}
void bar() {
int x;
foo(x);
}
The result of trying to compile is
gcc -c -v template.cc -pedantic
Reading specs from /usr/local/lib/gcc-lib/i686-linux-gnu/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
/usr/local/lib/gcc-lib/i686-linux-gnu/egcs-2.91.57/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -pedantic -Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ template.cc /tmp/ccP2gdme.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/g++
/usr/local/include
/usr/local/i686-linux-gnu/include
/usr/local/lib/gcc-lib/i686-linux-gnu/egcs-2.91.57/include
/usr/include
End of search list.
/usr/local/lib/gcc-lib/i686-linux-gnu/egcs-2.91.57/cc1plus /tmp/ccP2gdme.ii -quiet -dumpbase template.cc -pedantic -version -o /tmp/cc3GC1hi.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (i686-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
template.cc: In function `void foo(T)':
template.cc:9: parse error before `;'
I don't get the error compiling without -pedantic.
My system is a Linux/GNU system, (version 2.1.125 of the kernel) running on a
Cyrix PR 200MX processor. The egcs version is egcs-1.1a (egcs-2.91.57 19980901)
I don't know off hand the options I passed to configure, but it was nothing
unusual.
Karl Millar.
More information about the Gcc-bugs
mailing list