This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Error detection with templates and STL


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]