[ROOT] Dictionary not compilable with GCC 3.0

From: Brett Viren (bv@bnl.gov)
Date: Fri Aug 09 2002 - 20:23:46 MEST


Hi,

Bug report for you.


We have a class (PlexSEIdAltL) which subclasses an STL vector
(std::vector<PlexSEIdAltLItem>) and has a LinkDef.h entry like:

#pragma link C++ class PlexSEIdAltL+;

The generated Streamer code failes to compile under GCC 3.0.4.  The
generated code is:

void PlexSEIdAltL::Streamer(TBuffer &R__b)
{
   // Stream an object of class PlexSEIdAltL.

   if (R__b.IsReading()) {
      PlexSEIdAltL::Class()->ReadBuffer(R__b, this);
      {
         clear();
         int R__i, R__n;
         R__b >> R__n;
         for (R__i = 0; R__i < R__n; R__i++) {
            PlexSEIdAltLItem R__t;
            R__t.Streamer(R__b);
            push_back(R__t);
         }
      }
   } else {
      PlexSEIdAltL::Class()->WriteBuffer(R__b, this);
      {
         R__b << int(size());
         vector<PlexSEIdAltLItem,__malloc_alloc_template<0> >::iterator R__k;
         for (R__k = begin(); R__k != end(); ++R__k) {  // <---- ERROR
            (*R__k).Streamer(R__b);
         }
      }
   }
}

Where I have marked the line generating the error.  If the declaration
of the iterator is changed from:

	vector<PlexSEIdAltLItem,__malloc_alloc_template<0> >::iterator R__k;
to
	vector<PlexSEIdAltLItem>::iterator R__k;

then compilation succeeds.  

The error message is:

/home/bviren/srt/minossoft/releases/development/tmp/Linux2-GCC_3_0/Plex/libPlex-shared/PlexCint.cc: In
   member function `virtual void PlexSEIdAltL::Streamer(TBuffer&)':
/home/bviren/srt/minossoft/releases/development/tmp/Linux2-GCC_3_0/Plex/libPlex-shared/PlexCint.cc:2209: no
   match for `std::__normal_iterator<PlexSEIdAltLItem*, 
   std::vector<PlexSEIdAltLItem, std::__malloc_alloc_template<0> > >& = 
   std::__normal_iterator<PlexSEIdAltLItem*, std::vector<PlexSEIdAltLItem, 
   std::allocator<PlexSEIdAltLItem> > >' operator
/usr/include/g++-v3/bits/stl_iterator.h:453: candidates are: 
   std::__normal_iterator<PlexSEIdAltLItem*, std::vector<PlexSEIdAltLItem, 
   std::__malloc_alloc_template<0> > >& 
   std::__normal_iterator<PlexSEIdAltLItem*, std::vector<PlexSEIdAltLItem, 
   std::__malloc_alloc_template<0> > >::operator=(const 
   std::__normal_iterator<PlexSEIdAltLItem*, std::vector<PlexSEIdAltLItem, 
   std::__malloc_alloc_template<0> > >&)

(and a similar error for the "!=" operation)

Which, if you stare at it long enough, seems that std::vector::begin()
returns an iterator with a different allocator than the explicitly
stated one.


ROOT is from CVS as of yesterday or so, GCC 3.0.4 on Debian x86.

-Brett.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:03 MET