[Spirit?] core dump in endl?

Hello, I enclose a Spirit parser with two BOOST_FOREACH loops, one of which works and the other coredumps. I also enclose a gdb backtrace. Can you explain what's going on here? TIA

I enclose a Spirit parser with two BOOST_FOREACH loops, one of which works and the other coredumps. I also enclose a gdb backtrace.
Can you explain what's going on here?
If you add the return statement to your operator<<(), everything will be fine. For instance: std::ostream& operator<<(std::ostream& o, const test& b) { b.print(o); return o; // <-- here }; Regards Hartmut --------------- Meet me at BoostCon www.boostcon.com

Hartmut Kaiser wrote:
I enclose a Spirit parser with two BOOST_FOREACH loops, one of which works and the other coredumps. I also enclose a gdb backtrace.
Can you explain what's going on here?
If you add the return statement to your operator<<(), everything will be fine. For instance:
std::ostream& operator<<(std::ostream& o, const test& b) { b.print(o); return o; //<-- here };
Regards Hartmut
I use VS, 2008. My paste and run, that was obvious from the compiler error and knowing the stream call must return the stream. What is this that it would compile and run without a proper return?!? Best, Dan.

On Sun, Apr 11, 2010 at 11:09:21PM -0700, Dan Bloomquist wrote:
What is this that it would compile and run without a proper return?!?
There is no requirement on any implementation that omitting a return should be an error, and rightly so, as you may have guaranteed that control flow is diverted in other ways, like exceptions, std::terminate() or other amusing ways. However, many implementations do offer diagnostic warnings on higher warning levels for such common and accidental omissions. -- Lars Viklund | zao@acc.umu.se
participants (4)
-
Dan Bloomquist
-
Hartmut Kaiser
-
Lars Viklund
-
philip tucker