[Q] class template ctor, cctor and dtor decls??

gcl++ Library development m.cvjetko-no-spam@rt.e-technik.uni-erlangen.de
Mon Mar 8 02:55:00 GMT 1999


/*
                egcs@cygnus.com, 
		egcs-bugs@cygnus.com
		comp.lang.c++

  reply to  : 
                vcvjetko@linux.rulz.zg.tel.hr
		cvjetko@linux.rulz.rt.e-technik.uni-erlangen.de

                by removing praising the best OS

  [Q] class template ctor, cctor and dtor decls??

  Hi again!

  Wich one declaration of the template class and its ctors and dtor
  is proper acording to Standard??
  Is it for class X or for class X1?
  If the declaration for X<T> is OK, is it a bug if for such dtor decl 
  compiler reports a syntax error. Or why does it accept decls for ctor
  and not for dtor?? Is it a compiler bug??

  Secondly, if the decl for X1<T> is OK, how comes it accepts copy ctor
  (cctor) argument X1& instead of X1<T>& ??

  Thanx a lot

  mel

 */

template<class T>
class X
{
public:
  X<T>  ();
  X<T>  (const X<T>& );
  ~X<T> ();
};

template<class T>
class X1
{
public:
  X1  ();
  X1  (const X1& );
  ~X1 ();
};

/*
  ----------------------------------------------------------------------
> e++ -v BUG_egcs_1.1.1_template_dtor_declaration.cpp
Reading specs from
/usr/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
 /usr/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60/cpp -lang-c++
-v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91
-D__ELF__ -Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__
-D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux
-Asystem(posix) -D__EXCEPTIONS -Asystem(unix) -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586
-D__i586__ -D__pentium -D__pentium__
BUG_egcs_1.1.1_template_dtor_declaration.cpp /tmp/ccKyCLvj.ii
GNU CPP version egcs-2.91.60 19981201 (egcs-1.1.1 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/egcs/include/g++
 /usr/local/include
 /usr/egcs/i586-pc-linux-gnulibc1/include
 /usr/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60/include
 /usr/include
End of search list.
 /usr/egcs/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.60/cc1plus
/tmp/ccKyCLvj.ii -quiet -dumpbase
BUG_egcs_1.1.1_template_dtor_declaration.cc -version -o /tmp/ccZESYCk.s
GNU C++ version egcs-2.91.60 19981201 (egcs-1.1.1 release)
(i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.91.60 19981201
(egcs-1.1.1 release).
BUG_egcs_1.1.1_template_dtor_declaration.cpp:37: syntax error before `<'
> 
  ----------------------------------------------------------------------
 */
/*
Miljenko Jurica Cvjetko Dipl.Ing.
Lehrstuhl fuer Regelungstechnik 
Universitaet Erlangen-Nuernberg
e-mail:	 
         m.cvjetko-no-spam@rt.e-technik.uni-erlangen.de
         vcvjetko-no-spam@zg.tel.hr
	 remove (-no-spam) when replying please!!!
*/


More information about the Gcc-bugs mailing list