Opened 10 years ago

Closed 6 years ago

#7356 closed Bugs (fixed)

program crashed when using phoenix::switch_,case<> with STL::for_each, using std::vector<int> as the container

Reported by: wqgg123@… Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost 1.51.0 Severity: Problem
Keywords: phoenix::switch_ Cc:

Description

Problem: the program is listed as bellow, complied with mingw32-gcc-4.6.2, enabling std++0x. The program is OK when running in debug model, but crashed in release mode. The error code is -1073741819.

#include <iostream> #include <vector> #include <algorithm> #include <boost/phoenix.hpp>

using namespace std; using namespace boost; using phoenix::placeholders::arg1;

int main() {

vector<int> vec = {1, 2, 3, 4, 5, 6, 7, 8, 9};

for_each(vec.begin(), vec.end(),

switch_(arg1) [

phoenix::case_<1>(cout << phoenix::val("One") << '\n'), phoenix::case_<2>(cout << phoenix::val("Two") << '\n'), phoenix::default_(cout << phoenix::val("other value") << '\n')

]);

return 0;

}

Change History (3)

comment:1 by viboes, 10 years ago

Component: Nonephoenix
Owner: set to Thomas Heller

comment:3 by Kohei Takahashi, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.