Article View: gnu.g++.bug
Article #1231bug in template?
From: Xiaojun Zhu
Date: Sun, 22 Nov 1992 16:54
Date: Sun, 22 Nov 1992 16:54
43 lines
1557 bytes
1557 bytes
Q: Gnu C++ has parse error on L<T> ? Is this due to a bug or incomplete
template support?
Symptom: The following example(consists of two short files) compiles fine under
ATT C++ 3.0, but has parse error on line 8 of the first file when use g++.
Machine: MSDOS
Version: djgpp109.zip (uploaded to Simtel on Nov2, 1992)
Command line: gcc -x c++ main.cc
My opinion: It seems to me that this version of Gnu C++ doesn't like us to use
L<T>, L<T1, T2> etc. in the construction of template class.
Example:
file1: template.h
1 template<class T>
2 class L
3 {
4 T _t;
5
6 public:
7 L(T t) : _t(t) {}
8 L(const L < T > & l) : _t(l._t) {}
9 ~L() {}
10 };
file2: main.cc
0. #include "template.h"
1 main()
2 {
3 L<int> x(2);
4 }
--------------------------------------------------------------
A template version of signature class is under repair.
Symptom: I can't seem to be able to dynamically allocate it.
xjzhu@math.uwaterloo.ca
--------------------------------------------------------------
Technical Details
Message-ID:
<By4Myz.EHA@math.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!math.uwaterloo.ca!xjzhuShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!math.uwaterloo.ca!xjzhu From: xjzhu@math.uwaterloo.ca (Xiaojun Zhu) Subject: bug in template? Message-ID: <By4Myz.EHA@math.uwaterloo.ca> Keywords: parse error, template Sender: gnulists@ai.mit.edu Organization: University of Waterloo Distribution: gnu Date: Sun, 22 Nov 1992 16:54:34 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 44