
On 11/23/2012 09:46 AM, Andrey Semashev wrote:
On Fri, Nov 23, 2012 at 12:28 PM, Gaetano Mendola <mendola@gmail.com> wrote:
Hi all, after banging my head for an entire day I come out with this test case showing a possible bug in gcc 4.4.3 or in boost optional, the test crashes with a pure virtual method called only if compiled only with -O1, -O2, -O3. The same code in another machine with gcc 4.7.2 and boost 1.49 works fine.
The only virtual function I see is B::bar so I assume that's where it breaks. That's only possible if the compiler messed up the second D's construction somehow. IMO, this is a compiler issue since optional is not used with D. Did you try to accept the D::foo argument by const reference instead of by value?
Same problem, what is puzzling me is that you can make it working doing the following: - Remove the noncopyable from B or - Remove one of the two segments in the extra scope in main or - Remove the try { } catch Regards Gaetano Mendola