Boost logo

Boost Users :

From: Martin Apel (martin.apel_at_[hidden])
Date: 2008-06-13 04:50:32


Hi all,

I posted this issue a week ago to the Spirit mailing list only, but I
got no reply. So I repost this onto the Boost mailing list as well:

I tried to compile a Spirit grammar parsing a real number using closures
under Microsoft Visual C++ 2005. The same grammar compiles fine on Linux
using GCC 4.x. Boost version is 1.35.0 in both cases. As far as I
understood, the error is caused by an assertion inside the closure class
template:
  closure_frame_t& context() { assert(frame!=0); return
frame.get(); } (line 352 of
boost/spirit/phoenix/closures.hpp)

Even if I define NDEBUG, Phoenix closures don't compile, because the
return statement after the assertion returns a pointer to a
closure_frame_t and not a reference. From my point of view, this is not
really a compiler issue, but a bug in the header file
boost/spirit/phoenix/closures.hpp. I do not understand, why GCC compiles
this without any errors, because I think the code should not compile at all.
Any help would be appreciated.

Martin

C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352) :
error C2784: 'impl::make_binary3<phoenix::not_eq_op,BaseT0,BaseT1>::type
phoenix::operator !=(const phoenix::actor<BaseT> &,const
phoenix::actor<BaseT> &)' : could not deduce template argument for
'const phoenix::actor<BaseT> &' from
'phoenix::impl::closure_frame_holder<FrameT>'
3> with
3> [
3>
FrameT=phoenix::closure_frame<phoenix::closure<double,phoenix::nil_t,phoenix::nil_t>>

3> ]
3>
C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/operators.hpp(1869)
: see declaration of 'phoenix::operator !='
3>
C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352) :
while compiling class template member function
'phoenix::closure_frame<ClosureT>
&phoenix::closure<T0,T1,T2>::context(void)'
3> with
3> [
3>
ClosureT=phoenix::closure<double,phoenix::nil_t,phoenix::nil_t>,
3> T0=double,
3> T1=phoenix::nil_t,
3> T2=phoenix::nil_t
3> ]
3>
C:\Programme\boost\boost_1_35_0\boost/spirit/attribute/closure.hpp(226)
: see reference to class template instantiation
'phoenix::closure<T0,T1,T2>' being compiled
3> with
3> [
3> T0=double,
3> T1=phoenix::nil_t,
3> T2=phoenix::nil_t
3> ]
3> E:\ma\new_arch\base/SpiritSupport.h(67) : see reference to
class template instantiation 'boost::spirit::closure<DerivedT,T0>' being
compiled
3> with
3> [
3> DerivedT=NSBase::ExtRealParserClosure,
3> T0=double
3> ]
3>C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352)
: error C2784: 'impl::make_binary2<phoenix::not_eq_op,T0,BaseT>::type
phoenix::operator !=(T0,const phoenix::actor<BaseT> &)' : could not
deduce template argument for 'const phoenix::actor<BaseT> &' from 'int'
3>
C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/operators.hpp(1861)
: see declaration of 'phoenix::operator !='
3>C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352)
: error C2784: 'impl::make_binary1<phoenix::not_eq_op,BaseT,T1>::type
phoenix::operator !=(const phoenix::actor<BaseT> &,T1)' : could not
deduce template argument for 'const phoenix::actor<BaseT> &' from
'phoenix::impl::closure_frame_holder<FrameT>'
3> with
3> [
3>
FrameT=phoenix::closure_frame<phoenix::closure<double,phoenix::nil_t,phoenix::nil_t>>

3> ]
3>
C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/operators.hpp(1853)
: see declaration of 'phoenix::operator !='
3>C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352)
: error C2676: binary '!=' :
'phoenix::impl::closure_frame_holder<FrameT>' does not define this
operator or a conversion to a type acceptable to the predefined operator
3> with
3> [
3>
FrameT=phoenix::closure_frame<phoenix::closure<double,phoenix::nil_t,phoenix::nil_t>>

3> ]
3>C:\Programme\boost\boost_1_35_0\boost/spirit/phoenix/closures.hpp(352)
: error C2440: 'return' : cannot convert from
'phoenix::closure_frame<ClosureT> *' to
'phoenix::closure_frame<ClosureT> &'
3> with
3> [
3>
ClosureT=phoenix::closure<double,phoenix::nil_t,phoenix::nil_t>
3> ]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net