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]

possible bug in gcc 2.95.1 (C++)


I don't know enough about C++ to know if this is a bug or not, but I
can't figure it out.  If this is my fault let me know :)

Version: gcc 2.95.1
OS: Linux 2.2.12, glibc 2.1 (self-built system)

How to reproduce bug:

get ftp://ftp.nllgg.nl/pub/SGMLtools/v2.0/source/sgmltools-2.0.2.tar.bz2
and try to compile it :)

You should get a bunch of errors about templates already being
instantiated.  This is one bug, I think - adding explicit instantiations
fixed the problem; should this be necessary?

Then, apply the attached patch and re-make.  You should then get two
errors stating that certain templated members can't be found, even
though as far as I can tell they're there.

Mick.
diff -u -r orig/sgmltools-2.0.2/packages/cvs/jade/include/ISet.h sgmltools-2.0.2/packages/cvs/jade/include/ISet.h
--- orig/sgmltools-2.0.2/packages/cvs/jade/include/ISet.h	Tue Oct 13 21:24:39 1998
+++ sgmltools-2.0.2/packages/cvs/jade/include/ISet.h	Thu Oct 28 00:07:08 1999
@@ -47,6 +47,8 @@
   Vector<ISetRange<T> > r_;
 };
 
+template<> class Vector<ISetRange<unsigned int> > {};
+template<> class Vector<ISetRange<short unsigned int> > {};
 #ifdef SP_NAMESPACE
 }
 #endif
diff -u -r orig/sgmltools-2.0.2/packages/cvs/jade/include/RangeMap.h sgmltools-2.0.2/packages/cvs/jade/include/RangeMap.h
--- orig/sgmltools-2.0.2/packages/cvs/jade/include/RangeMap.h	Tue Oct 13 21:24:42 1998
+++ sgmltools-2.0.2/packages/cvs/jade/include/RangeMap.h	Thu Oct 28 00:10:46 1999
@@ -36,6 +36,8 @@
   friend class RangeMapIter<From,To>;
 };
 
+template <> class Vector<RangeMapRange<unsigned int,unsigned int> > {};
+
 template<class From, class To>
 class RangeMapIter {
 public:
diff -u -r orig/sgmltools-2.0.2/packages/cvs/jade/include/StringC.h sgmltools-2.0.2/packages/cvs/jade/include/StringC.h
--- orig/sgmltools-2.0.2/packages/cvs/jade/include/StringC.h	Tue Oct 13 21:24:43 1998
+++ sgmltools-2.0.2/packages/cvs/jade/include/StringC.h	Thu Oct 28 10:36:30 1999
@@ -11,6 +11,8 @@
 namespace SP_NAMESPACE {
 #endif
 
+template<> class String<Char> {};
+
 typedef String<Char> StringC;
 
 #ifdef SP_NAMESPACE
diff -u -r orig/sgmltools-2.0.2/packages/cvs/jade/include/StringOf.h sgmltools-2.0.2/packages/cvs/jade/include/StringOf.h
--- orig/sgmltools-2.0.2/packages/cvs/jade/include/StringOf.h	Tue Oct 13 21:24:43 1998
+++ sgmltools-2.0.2/packages/cvs/jade/include/StringOf.h	Thu Oct 28 11:31:43 1999
@@ -22,6 +22,12 @@
 template<class T>
 class String {
 public:
+  void swap(String<T> &str);
+  void AddChar(Char c) {
+    if (length_ >= alloc_)
+      grow(1);
+    ptr_[length_++] = c;
+  }
   typedef size_t size_type;
   typedef T *iterator;
   typedef const T *const_iterator;
@@ -33,17 +39,13 @@
   size_t size() const { return length_; }
   String<T> &assign(const T *, size_t);
   String<T> &insert(size_t i, const String<T> &s);
-  void swap(String<T> &str);
   T operator[](size_t i) const { return ptr_[i]; }
   T &operator[](size_t i) { return ptr_[i]; }
   iterator begin() { return ptr_; }
   const_iterator begin() const { return ptr_; }
   const T *data() const { return ptr_; }
-  String<T> &operator+=(T c) {
-    if (length_ >= alloc_)
-      grow(1);
-    ptr_[length_++] = c;
-    return *this;
+  String<T>& operator+= (T c) {
+    AddChar(c); return *this;
   }
   String<T> &operator+=(const String<T> &s) {
     append(s.ptr_, s.length_);
diff -u -r orig/sgmltools-2.0.2/packages/cvs/jade/lib/CharsetInfo.cxx sgmltools-2.0.2/packages/cvs/jade/lib/CharsetInfo.cxx
--- orig/sgmltools-2.0.2/packages/cvs/jade/lib/CharsetInfo.cxx	Tue Oct 13 21:24:46 1998
+++ sgmltools-2.0.2/packages/cvs/jade/lib/CharsetInfo.cxx	Thu Oct 28 10:49:28 1999
@@ -129,7 +129,7 @@
 {
   StringC result;
   while (*s != '\0')
-    result += execToDesc(*s++);
+    result.AddChar((short unsigned int)execToDesc(*s++));
   return result;
 }
 

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