From: FLEINERC%CFRUNI51.BITNET@mitvma.mit.edu
Subject: Problems with assembler and templates
Organization: Gnus Not Usenet
Distribution: gnu
Date: Mon, 5 Oct 1992 11:57:00 GMT

Hello

I have a problem with templates in c++:

When compiling the programm temp.cc, the assembler does not like the
generated "vector<int>" definitions. (see error messages) .
When I change the '<' and '>' characters to any letter, I can compile
the program without any problems. Is there any way to instruct
gcc to NOT use '<' and '>' ?

I use gcc Version 2.1 on Interactive UNIX 3.2:
        Reading specs from /usr2/lib/gcc/lib/gcc-lib/isc/2.1/specs
        gcc version 2.1
Assembler: as: assembler - C Software Development System 4.1.5 10/3/89

thanks for any help

Claudio Fleiner (fleinerc@cfruni52.bitnet)


/*************************** temp.cc **************************3
#include <stream.h>

template<class T> class vector {
        T* v;
        int sz;
public:
        vector(int i) { cout << "in vector\n"; v=new int[i]; sz=i; }
        ~vector(void) { cout << "in ~vector\n"; delete[] v; }
};

main()
{
        vector<int> g(8);
        int j;
}



/*********************************************************************/
/********* gcc -S -g -O temp.cc    --->   temp.s *********************/
/*********************************************************************/
  .file  "temp.cc"
gcc2_compiled.:
text
  .def  ptrdiff_t;  .scl  13;  .type  04;  .endef
  .def  size_t;  .scl  13;  .type  016;  .endef
  .def  wchar_t;  .scl  13;  .type  04;  .endef
  .def  streamoff;  .scl  13;  .type  04;  .endef
  .def  streampos;  .scl  13;  .type  04;  .endef
  .def  _ios_fields;  .scl  10;  .type  010;  .size  20;  .endef
  .def  _strbuf;  .val  0;  .scl  8;  .type  030;  .endef
  .def  _tie;  .val  4;  .scl  8;  .type  030;  .endef
  .def  _width;  .val  8;  .scl  8;  .type  04;  .endef
  .def  _flags;  .val  12;  .scl  8;  .type  016;  .endef
  .def  _fill;  .val  16;  .scl  8;  .type  02;  .endef
  .def  _state;  .val  17;  .scl  8;  .type  014;  .endef
  .def  _precision;  .val  18;  .scl  8;  .type  015;  .endef
  .def  .eos;  .val  20;  .scl  102;  .tag  _ios_fields;  .size  20;  .endef
  .def  _ios_fields;  .scl  13;  .tag  _ios_fields;  .size  20;  .type  010;  .e
ndef
  .def  .0fake;  .scl  15;  .type  012;  .size  4;  .endef
  .def  _bad;  .val  4;  .scl  16;  .type  013;  .endef
  .def  _fail;  .val  2;  .scl  16;  .type  013;  .endef
  .def  _eof;  .val  1;  .scl  16;  .type  013;  .endef
  .def  _good;  .val  0;  .scl  16;  .type  013;  .endef
  .def  .eos;  .val  4;  .scl  102;  .tag  .0fake;  .size  4;  .endef
  .def  state_value;  .scl  13;  .tag  .0fake;  .size  4;  .type  012;  .endef
  .def  .1fake;  .scl  15;  .type  012;  .size  4;  .endef
  .def  badbit;  .val  4;  .scl  16;  .type  013;  .endef
  .def  failbit;  .val  2;  .scl  16;  .type  013;  .endef
  .def  eofbit;  .val  1;  .scl  16;  .type  013;  .endef
  .def  goodbit;  .val  0;  .scl  16;  .type  013;  .endef
  .def  .eos;  .val  4;  .scl  102;  .tag  .1fake;  .size  4;  .endef
  .def  io_state;  .scl  13;  .tag  .1fake;  .size  4;  .type  012;  .endef
  .def  .2fake;  .scl  15;  .type  012;  .size  4;  .endef
  .def  noreplace;  .val  64;  .scl  16;  .type  013;  .endef
  .def  nocreate;  .val  32;  .scl  16;  .type  013;  .endef
  .def  trunc;  .val  16;  .scl  16;  .type  013;  .endef
  .def  app;  .val  8;  .scl  16;  .type  013;  .endef
  .def  ate;  .val  4;  .scl  16;  .type  013;  .endef
  .def  out;  .val  2;  .scl  16;  .type  013;  .endef
  .def  in;  .val  1;  .scl  16;  .type  013;  .endef
  .def  .eos;  .val  4;  .scl  102;  .tag  .2fake;  .size  4;  .endef
  .def  open_mode;  .scl  13;  .tag  .2fake;  .size  4;  .type  012;  .endef
  .def  .3fake;  .scl  15;  .type  012;  .size  4;  .endef
  .def  end;  .val  2;  .scl  16;  .type  013;  .endef
  .def  cur;  .val  1;  .scl  16;  .type  013;  .endef
  .def  beg;  .val  0;  .scl  16;  .type  013;  .endef
  .def  .eos;  .val  4;  .scl  102;  .tag  .3fake;  .size  4;  .endef
  .def  seek_dir;  .scl  13;  .tag  .3fake;  .size  4;  .type  012;  .endef
  .def  .4fake;  .scl  15;  .type  012;  .size  4;  .endef
  .def  dont_close;  .val  -2147483648;  .scl  16;  .type  013;  .endef
  .def  stdio;  .val  16384;  .scl  16;  .type  013;  .endef
  .def  unitbuf;  .val  8192;  .scl  16;  .type  013;  .endef
  .def  fixed;  .val  32768;  .scl  16;  .type  013;  .endef
  .def  scientific;  .val  2048;  .scl  16;  .type  013;  .endef
  .def  showpos;  .val  1024;  .scl  16;  .type  013;  .endef
  .def  uppercase;  .val  512;  .scl  16;  .type  013;  .endef
  .def  showpoint;  .val  256;  .scl  16;  .type  013;  .endef
  .def  showbase;  .val  128;  .scl  16;  .type  013;  .endef
  .def  hex;  .val  64;  .scl  16;  .type  013;  .endef
  .def  oct;  .val  32;  .scl  16;  .type  013;  .endef
  .def  dec;  .val  16;  .scl  16;  .type  013;  .endef
  .def  internal;  .val  8;  .scl  16;  .type  013;  .endef
  .def  right;  .val  4;  .scl  16;  .type  013;  .endef
  .def  left;  .val  2;  .scl  16;  .type  013;  .endef
  .def  skipws;  .val  1;  .scl  16;  .type  013;  .endef
  .def  .eos;  .val  4;  .scl  102;  .tag  .4fake;  .size  4;  .endef
  .def  ios;  .scl  10;  .type  010;  .size  20;  .endef
  .def  _ios_fields;  .val  0;  .scl  8;  .tag  _ios_fields;  .size  20;  .type
 010;  .endef
  .def  .eos;  .val  20;  .scl  102;  .tag  ios;  .size  20;  .endef
  .def  ios;  .scl  13;  .tag  ios;  .size  20;  .type  010;  .endef
  .def  _seek_dir;  .scl  13;  .tag  .3fake;  .size  4;  .type  012;  .endef
  .def  __streambuf;  .scl  10;  .type  010;  .size  40;  .endef
  .def  _flags;  .val  0;  .scl  8;  .type  04;  .endef
  .def  _gptr;  .val  4;  .scl  8;  .type  022;  .endef
  .def  _egptr;  .val  8;  .scl  8;  .type  022;  .endef
  .def  _eback;  .val  12;  .scl  8;  .type  022;  .endef
  .def  _pbase;  .val  16;  .scl  8;  .type  022;  .endef
  .def  _pptr;  .val  20;  .scl  8;  .type  022;  .endef
  .def  _epptr;  .val  24;  .scl  8;  .type  022;  .endef
  .def  _base;  .val  28;  .scl  8;  .type  022;  .endef
  .def  _ebuf;  .val  32;  .scl  8;  .type  022;  .endef
  .def  _chain;  .val  36;  .scl  8;  .type  030;  .endef
  .def  .eos;  .val  40;  .scl  102;  .tag  __streambuf;  .size  40;  .endef
  .def  __streambuf;  .scl  13;  .tag  __streambuf;  .size  40;  .type  010;  .e
ndef
  .def  streambuf;  .scl  10;  .type  010;  .size  44;  .endef
  .def  __streambuf;  .val  0;  .scl  8;  .tag  __streambuf;  .size  40;  .type
 010;  .endef
  .def  _vptr.streambuf;  .val  40;  .scl  8;  .dim  13;  .size  4;  .type  0330
;  .endef
  .def  .eos;  .val  44;  .scl  102;  .tag  streambuf;  .size  44;  .endef
  .def  streambuf;  .scl  13;  .tag  streambuf;  .size  44;  .type  010;  .endef
  .def  __file_fields;  .scl  10;  .type  010;  .size  20;  .endef
  .def  _fake;  .val  0;  .scl  8;  .type  02;  .endef
  .def  _shortbuf;  .val  1;  .scl  8;  .dim  1;  .size  1;  .type  062;  .endef
  .def  _fileno;  .val  2;  .scl  8;  .type  03;  .endef
  .def  _blksize;  .val  4;  .scl  8;  .type  04;  .endef
  .def  _save_gptr;  .val  8;  .scl  8;  .type  022;  .endef
  .def  _save_egptr;  .val  12;  .scl  8;  .type  022;  .endef
  .def  _offset;  .val  16;  .scl  8;  .type  04;  .endef
  .def  .eos;  .val  20;  .scl  102;  .tag  __file_fields;  .size  20;  .endef
  .def  __file_fields;  .scl  13;  .tag  __file_fields;  .size  20;  .type  010;
  .endef
  .def  filebuf;  .scl  10;  .type  010;  .size  64;  .endef
  .def  streambuf;  .val  0;  .scl  8;  .tag  streambuf;  .size  44;  .type  010
;  .endef
  .def  _fb;  .val  44;  .scl  8;  .tag  __file_fields;  .size  20;  .type  010;
  .endef
  .def  .eos;  .val  64;  .scl  102;  .tag  filebuf;  .size  64;  .endef
  .def  filebuf;  .scl  13;  .tag  filebuf;  .size  64;  .type  010;  .endef
  .def  __imanip;  .scl  13;  .type  0630;  .endef
  .def  __omanip;  .scl  13;  .type  0630;  .endef
  .def  ostream;  .scl  10;  .type  010;  .size  20;  .endef
  .def  ios;  .val  0;  .scl  8;  .tag  ios;  .size  20;  .type  010;  .endef
  .def  .eos;  .val  20;  .scl  102;  .tag  ostream;  .size  20;  .endef
  .def  ostream;  .scl  13;  .tag  ostream;  .size  20;  .type  010;  .endef
  .def  istream;  .scl  10;  .type  010;  .size  24;  .endef
  .def  ios;  .val  0;  .scl  8;  .tag  ios;  .size  20;  .type  010;  .endef
  .def  _gcount;  .val  20;  .scl  8;  .type  016;  .endef
  .def  .eos;  .val  24;  .scl  102;  .tag  istream;  .size  24;  .endef
  .def  istream;  .scl  13;  .tag  istream;  .size  24;  .type  010;  .endef
  .def  iostream;  .scl  10;  .type  010;  .size  24;  .endef
  .def  ios;  .val  0;  .scl  8;  .tag  ios;  .size  20;  .type  010;  .endef
  .def  _gcount;  .val  20;  .scl  8;  .type  016;  .endef
  .def  .eos;  .val  24;  .scl  102;  .tag  iostream;  .size  24;  .endef
  .def  iostream;  .scl  13;  .tag  iostream;  .size  24;  .type  010;  .endef
  .def  Iostream_init;  .scl  10;  .type  010;  .size  1;  .endef
  .def  .eos;  .val  1;  .scl  102;  .tag  Iostream_init;  .size  1;  .endef
  .def  Iostream_init;  .scl  13;  .tag  Iostream_init;  .size  1;  .type  010;
 .endef
  .def  vector<int>;  .scl  10;  .type  010;  .size  8;  .endef
/*ERROR:      ^^^^^ **********************************************************/
  .def  v;  .val  0;  .scl  8;  .type  024;  .endef
  .def  sz;  .val  4;  .scl  8;  .type  04;  .endef
  .def  .eos;  .val  8;  .scl  102;  .tag  vector<int>;  .size  8;  .endef
  .def  vector<int>;  .scl  13;  .tag  vector<int>;  .size  8;  .type  010;  .en
def
/*ERROR:      ^^^^^ *************************^^^^^****************************/
  .def  vector<int>;  .scl  13;  .tag  vector<int>;  .size  8;  .type  010;  .en
def
  .align 4
  .def  main;  .val  main;  .scl  2;  .type  044;  .endef
globl main
main:
  pushl %ebp
  movl %esp,%ebp
  subl $8,%esp
  pushl %ebx
  .def  .bf;  .val  .;  .scl  101;  .line  12;  .endef
  .ln  2
  .def  .bb;  .val  .;  .scl  100;  .line  2;  .endef
  .def  g;  .val  -8;  .scl  1;  .tag  vector<int>;  .size  8;  .type  010;  .en
def
  pushl $8
  leal -8(%ebp),%ebx
  pushl %ebx
  call __t6vector1Zii
  .def  .eb;  .val  .;  .scl  100;  .line  2;  .endef
  pushl $2
  pushl %ebx
  call _._t6vector1Zi
  xorl %eax,%eax
  .ln  4
  .def  .ef;  .val  .;  .scl  101;  .line  4;  .endef
  movl -12(%ebp),%ebx
  leave
  ret
  .def  main;  .val  .;  .scl  -1;  .endef
LC0:
  .byte 0x69,0x6e,0x20,0x7e,0x76,0x65,0x63,0x74,0x6f,0x72
  .byte 0xa,0x0
  .align 4
  .def  _._t6vector1Zi;  .val  _._t6vector1Zi;  .scl  3;  .type  044;  .endef
_._t6vector1Zi:
  pushl %ebp
  movl %esp,%ebp
  pushl %esi
  pushl %ebx
  movl 8(%ebp),%ebx
  movl 12(%ebp),%esi
  .def  .bf;  .val  .;  .scl  101;  .line  8;  .endef
  .def  .t;  .val  8;  .scl  9;  .tag  vector<int>;  .size  8;  .type  030;  .en
def
  .def  __in.chrg;  .val  12;  .scl  9;  .type  04;  .endef
  .def  .t;  .val  3;  .scl  4;  .tag  vector<int>;  .size  8;  .type  030;  .en
def
  .def  __in.chrg;  .val  6;  .scl  4;  .type  04;  .endef
  .ln  1
  pushl $.LC0
  pushl $cout
  call __ls__FR7ostreamPCc
  cmpl $0,(%ebx)
  je .L256
  pushl (%ebx)
  call __builtin_delete
  addl $4,%esp
L256:
  addl $8,%esp
  testl $1,%esi
  je .L259
  pushl %ebx
  call __builtin_delete
L259:
  .def  .ef;  .val  .;  .scl  101;  .line  1;  .endef
  leal -8(%ebp),%esp
  popl %ebx
  popl %esi
  leave
  ret
  .def  _._t6vector1Zi;  .val  .;  .scl  -1;  .endef
  .def  vector<int>;  .scl  13;  .tag  vector<int>;  .size  8;  .type  010;  .en
def
LC1:
  .byte 0x69,0x6e,0x20,0x76,0x65,0x63,0x74,0x6f,0x72,0xa
  .byte 0x0
  .align 4
  .def  __t6vector1Zii;  .val  __t6vector1Zii;  .scl  3;  .tag  vector<int>;  .s
ize  8;  .type  0150;  .endef
__t6vector1Zii:
  pushl %ebp
  movl %esp,%ebp
  pushl %esi
  pushl %ebx
  movl 8(%ebp),%ebx
  movl 12(%ebp),%esi
  .def  .bf;  .val  .;  .scl  101;  .line  7;  .endef
  .def  .t;  .val  8;  .scl  9;  .tag  vector<int>;  .size  8;  .type  030;  .en
def
  .def  i;  .val  12;  .scl  9;  .type  04;  .endef
  .def  .t;  .val  3;  .scl  4;  .tag  vector<int>;  .size  8;  .type  030;  .en
def
  .def  i;  .val  6;  .scl  4;  .type  04;  .endef
  .ln  1
  pushl $.LC1
  pushl $cout
  call __ls__FR7ostreamPCc
  leal 0(,%esi,4),%eax
  pushl %eax
  call __builtin_new
  movl %eax,(%ebx)
  movl %esi,4(%ebx)
  movl %ebx,%eax
  .def  .ef;  .val  .;  .scl  101;  .line  1;  .endef
  leal -8(%ebp),%esp
  popl %ebx
  popl %esi
  leave
  ret
  .def  __t6vector1Zii;  .val  .;  .scl  -1;  .endef
  .def  vector<int>;  .scl  13;  .tag  vector<int>;  .size  8;  .type  010;  .en
def



/******************************************************************/
/*********** Error messages ***************************************/
/******************************************************************/
Assembler: temp.cc
        aline 124       : Illegal character after '<'
        aline 124       : syntax error
        aline 127       : Illegal character after '<'
        aline 127       : syntax error
        aline 128       : Illegal character after '<'
        aline 128       : syntax error
        aline 128       : Illegal character after '<'
        aline 128       : syntax error
        aline 129       : Illegal character after '<'
        aline 129       : syntax error
        aline 129       : Illegal character after '<'
        aline 129       : syntax error
        aline 140       : Illegal character after '<'
        aline 140       : syntax error
        aline 154       : Illegal character after '<'
        aline 154       : syntax error
        aline 160       : Illegal character after '<'
        aline 160       : syntax error
        aline 162       : Illegal character after '<'
        aline 162       : syntax error
        aline 171       : Illegal character after '<'
        aline 171       : syntax error
        aline 171       : Illegal character after '<'
        aline 171       : syntax error

Stop.

Newsgroups: gnu.g++.bug