Error detection with templates and STL

Alexandre Oliva oliva@dcc.unicamp.br
Wed Oct 7 21:55:00 GMT 1998


llberg  <H> writes:

> The program below is in error, but the g++ should probably
> be able to detect it.

> #include  <set>
> template< class T > class A {};
> set<A> x;

thanks for your report.  The latest snapshot of egcs says:

t.cc:6: type/value mismatch at argument 1 in template parameter list for `template <class _Key, class _Compare = struct less<_Key>, class _Alloc = class allocator<_Tp1>> set<_Key,_Compare,_Alloc>'
t.cc:6:   expected a type, got `A'
t.cc:6: template argument 1 is invalid
t.cc:6: template argument 2 is invalid
t.cc:6: template argument 1 is invalid
t.cc:6: template argument 3 is invalid
t.cc:6: warning: ANSI C++ forbids declaration `x' with no type

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list