On Mon, 2 Jan 2006, Mark Mitchell wrote:
> Richard Guenther wrote:
> > g++ no longer parses
> >
> > ScalarCode<CflFunctor<Dim> >(CflFunctor<Dim>(omrot, vis_f))(scratch,
> > I, cs, nue, v);
> >
> > correctly, but issues
> >
> > tramp3d-v4.cpp:53573: error: invalid declarator
> >
> > which can be fixed by putting parantheses around the decl. Was this
> > change intended?
>
> I'm not sure; please send me preprocessed source, and I will look into
> it. It's certainly possible that those changes broke something.
>
> What do you think the above code is supposed to mean? Are you declaring
> a constructor for CflFunctor<Dim>, or an unnamed variable of type
> ScalarCode<CflFunctor<Dim> > or ?
It's
{
CflFunctor<Dim> tmp1(omrot, vis_f);
ScalarCode<CflFunctor<Dim> > tmp2(tmp1);
tmp2.operator()(scratch, I, cs, nue, v);
}
i.e. instantiating ScalarCode<CflFunctor<Dim> > using the constructor
that takes an argument of type CflFunctor<Dim> that is constructed
with the two params omrot and vis_f and then calling operator() on
the constructed object.
Source is from http://www.suse.de/~rguenther/tramp3d/tramp3d-v4.cpp.gz
A reduced testcase looks like
template <class T>
struct ScalarCode
{
ScalarCode(const T&);
template <class A, class B>
void operator()(const A&, const B&);
};
template <int Dim>
struct CflFunctor
{
CflFunctor(bool omrot, bool vis_f);
};
struct Bar {};
void foo(bool omrot, bool vis_f, const Bar& x, const Bar& y)
{
ScalarCode<CflFunctor<3> >(CflFunctor<3>(omrot, vis_f))(x, y);
}
Richard.