Error compiling dictionary for class with auto_ptr

From: Nicholas Devenish <misnomer_at_gmail.com>
Date: Fri, 5 Mar 2010 22:01:22 +0000


Hi Roottalk,

I'm getting an error compiling the dictionaries for a class that returns an auto_ptr from a const function. The problem is with a member function of the form:
  std::auto_ptr<int> SomeFun(void) const;

which results in the dictionary code:

   const auto_ptr<int>* pobj;
   const auto_ptr<int> xobj = ((const test*) G__getstructoffset())->GetInt();

   pobj = new auto_ptr<int>(xobj);

Giving the error when trying to compile the third line:

   error: passing ‘const std::auto_ptr<int>’ as ‘this’ argument of ‘std::auto_ptr<int>::operator std::auto_ptr_ref<int>()’ discards qualifiers because a non-const auto_ptr cannot be initialised by a const auto_ptr.

Attached is a *very* small test file that exhibits this behaviour, compiled with

   rootcint out.cxx -c test.h
   g++ -c out.cxx `root-config --cflags`

Is there a way to get the dictionaries to compile properly?

Thanks,

Nick

Received on Fri Mar 05 2010 - 23:01:28 CET

This archive was generated by hypermail 2.2.0 : Fri Mar 05 2010 - 23:50:01 CET