Joel de Guzman wrote:
Martin Apel wrote:
boost/spirit/phoenix/closures.hpp closure<..>::context() is declared to
return a reference to a closure_frame_t, which is a closure_frame.
The implementation consists of frame.get(), which invokes the get method
on holder_t, which is a closure_frame_holder. When
looking at the get method of closure_frame_holder, it
returns a reference to frame_ptr, which is a frame_t*, which is not the
same as an object of type closure_frame as declared by
closure<...>::context()
:-) I think you missed the #ifdef PHOENIX_THREADSAFE branch.
& phoenix::closure::context() [with T0 = int, T1 =
& phoenix::closure::context() [with T0 = int, T1 =
I don't think so. See the following small test function, which does not
do anything sensible, but from my understanding it should at least compile:
void test(void)
{
closure<int> c;
closure<int>::closure_frame_t& frame = c.context();
}
But it doesn't compile, even with gcc. The error is either (without
NDEBUG defined):
/scratch/apel/boost_install/linux32/include/boost-1_35/boost/spirit/phoenix/closures.hpp:
In member function 'phoenix::closure_frame
phoenix::nil_t, T2 = phoenix::nil_t]':
test2.cpp:9: instantiated from here
/scratch/apel/boost_install/linux32/include/boost-1_35/boost/spirit/phoenix/closures.hpp:352:
error: no match for 'operator!=' in '((phoenix::closure*)this)->phoenix::closure::frame != 0'
test2.cpp:9: instantiated from here
/scratch/apel/boost_install/linux32/include/boost-1_35/boost/spirit/phoenix/closures.hpp:352:
error: invalid initialization of reference of type
'phoenix::closure_frame >&' from expression of type
'phoenix::closure_frame >*'
or (with NDEBUG defined):
/scratch/apel/boost_install/linux32/include/boost-1_35/boost/spirit/phoenix/closures.hpp:
In member function 'phoenix::closure_frame
phoenix::nil_t, T2 = phoenix::nil_t]':
test2.cpp:9: instantiated from here
/scratch/apel/boost_install/linux32/include/boost-1_35/boost/spirit/phoenix/closures.hpp:352:
error: invalid initialization of reference of type
'phoenix::closure_frame >&' from expression of type
'phoenix::closure_frame >*'
Can you reproduce this?
Sorry, it wasn't meant as an accusation.
Nah, just kidding. That's why there was a smiley there ;-)
I had found this out some
months ago, so I tried to give an example from my memory. I didn't
expect Spirit to behave exactly as iostream, because there was no
specification with respect to numerical accuracy. Additionally I only
found this out, when setting the precision to 20, 15 is not enough. I
played around a bit, to find an example:
I'd appreciate it if you can add a bug report to Boost's trac.
Let's see if we can do better. Thanks for reporting this!
I added a bug report to Trac. It's got the number 2014.
Regards,
Martin