[ROOT] ROOT 2.25.01: CINT template bug affecting all STL containers

From: Matthew D. Langston (langston@SLAC.stanford.edu)
Date: Thu Aug 17 2000 - 01:09:08 MEST


I've come across a CINT bug in ROOT 2.25.01 that affects all STL
containers that depend on the "construct" template function (which, to
my knowledge, is all STL containers).  The nature of the bug looks like
it is an CINT internal compiler error, as CINT can't handle the
"construct" template function in "cint/stl/defalloc.h" (line 120).

I've attached a small test file (called "test_vector.C") that
demonstrates the problem.  The problem does not appear in ROOT 2.24.05
(i.e. "test_vector.C" and the rest of my template and STL code runs fine
with ROOT 2.24.05).  This is the error I get from ROOT 2.25.01:

  root [0] .x test_vector.C
  Error: Undeclared variable value FILE:defalloc.h LINE:120
  *** Interpreter error recovered ***
  root [1]


This is the C++ template code (from "cint/stl/defalloc.h) that CINT is
having trouble with:

  template <class T1, class T2>
  inline void construct(T1* p, const T2& value) {
      new (p) T1(value);
  }


Perhaps this is a good time to make another request for a ROOT test
suite.  If ROOT had such a test suite, then code like "test_vector.C"
could be put into it so that future releases of ROOT don't introduce
bugs that were fixed in previous releases.  Perhaps ROOT could start
with the gcc/g++ test suite.  Although CINT only promises to support 85%
of C++, it would at least let ROOT users know specifically what that 15%
of C++ we can't use is.


Regards, Matt

--
Matthew D. Langston
SLD, Stanford Linear Accelerator Center
langston@SLAC.Stanford.EDU


#include <string>
#include <vector>


void
test_vector()
{
   vector< const char* > my_vector;
   my_vector.push_back( "foo" );
   
   for ( vector< const char* >::const_iterator i = my_vector.begin(); i != my_vector.end(); ++i )
   {
      cout << *i << endl;
   }
}


// Local variables:
//  compile-command: "g++ `root-config --cflags` -Wall -c test_vector.C"
// End:



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET