SIndex<Dim>::clear() template method not compiling
While porting some of the IPPL tests to unit test I got the following compiler error:
In file included from /home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndex.h:302:0,
from /home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Field/BareField.h:31,
from /home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Field/Field.h:15,
from /home/scratch/OPAL/OPAL-fork/OPAL-src/tests/ippl_src/Index/Index.cpp:60:
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndex.hpp: In instantiation of ‘void SIndex<Dim>::clear() [with unsigned int Dim = 2]’:
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndexAssign.hpp:52:44: required from ‘static void SIndexAssignTraits<Dim, OpAssign>::initialize(SIndex<Dim>&) [with unsigned int Dim = 2]’
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndexAssign.hpp:347:41: required from ‘void assign(SIndex<Dim>&, RHS, OP, const NDIndex<Dim>&, SIExprTag<IsExpr>) [with unsigned int Dim = 2; RHS = PETE_TBTree<OpOr, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> >, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> > >; OP = OpAssign; bool IsExpr = false]’
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndexAssign.h:72:1: required from ‘void assign(SIndex<Dim>&, const PETE_Expr<T>&) [with unsigned int Dim = 2; RHS = PETE_TBTree<OpOr, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> >, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> > >]’
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndex.h:100:11: required from ‘SIndex<Dim>& SIndex<Dim>::operator=(const PETE_Expr<B>&) [with T1 = PETE_TBTree<OpOr, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> >, PETE_TBTree<OpEQ, BareFieldIterator<int, 2>, PETE_Scalar<int> > >; unsigned int Dim = 2]’
/home/scratch/OPAL/OPAL-fork/OPAL-src/tests/ippl_src/Index/Index.cpp:82:25: required from here
/home/scratch/OPAL/OPAL-fork/OPAL-src/ippl/src/Index/SIndex.hpp:339:10: error: ‘class std::shared_ptr<LSIndex<2> >’ has no member named ‘CopyForWrite’
(*a).CopyForWrite();
The method CopyForWrite()
is defined in the RefCountedP class LSIndex does not inherit from it (only from class RefCounted).
The relevant templated method was never used (and thus not compiled).