No Subject

Horst von Brand vonbrand@sleipnir.valparaiso.cl
Wed Dec 9 03:08:00 GMT 1998


D Maley <d.maley@stmarys-belfast.ac.uk> said:
> #include <vector.h>
> #include <numeric>
> 
> template <class T, class Alloc = alloc>
> class vector1 : public std::vector<T, Alloc> {
> public:
>   bool m();
> };
> 
> template <class T> bool f(bool valid, T t)
> {
>   return false;
> }
> 
> template <class T, class Alloc> bool vector1<T, Alloc>::m()
> {
>   return accumulate(begin(), end(), true, f<T>);
> }
> 
> int main()
> {
>   vector1<vector1<int>> yy;
>   yy.m();
> }

> [Gets ICE 980715 at line 17 with egcs-1.1b]

Same with egcs-1.1.1; the 19981206 snapshot gives:

vonbrand@sleipnir:/tmp$ c++ -c -O2 -Wall -W xxx.cc
xxx.cc: In function `int main()':
xxx.cc:22: warning: `>>' should be `> >' in template class name
xxx.cc: In function `bool f<vector1<int,__default_alloc_template<true,0>
>>(bool, class vector1<int,__default_alloc_template<true,0> >)':
xxx.cc:17:   instantiated from
`vector1<vector1<int,__default_alloc_template<true,0>
>,__default_alloc_template<true,0> >::m()'
xxx.cc:23:   instantiated from here
xxx.cc:11: warning: unused parameter `bool valid'
xxx.cc:11: warning: unused parameter `class
vector1<int,__default_alloc_template<true,0> > t'

Thanks for the report!

PS: It would probably be better if you sent in a preprocessed piece of
    code, so vagaries of the #include:d files won't alter the results. But
    I guess for this kind of stuff (using libstdc++ only, which is part of
    egcs) is fine.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile                               +56 32 672616



More information about the Gcc-bugs mailing list