id summary reporter owner description type status milestone component version severity resolution keywords cc 11705 Phoenix function defining operator() with non-const reference parameter fails to compile with C++ 11. David Williams Thomas Heller "A phoenix function object defining operator() with a non-const reference parameter does not compile when using clang version 3.5 in C++ 11 mode. The compiler used is: Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) The Boost version used is 1.59. A test program to illustrate the problem along with the compiler build log are provided with this bug report. An example of such a function object that reproduces the problem is the following: struct add_int_impl { typedef int result_type; add_int_impl(int v) { _value=v; } int operator()(bool& flag) const { std::cout << ""int operator()(bool& flag) called"" << std::endl; if (_value == 4) flag=true; return _value; } int _value; }; The function can be tested with the following code snippet: // *** Begin code snippet *** // Initialise the function with the value 4. boost::phoenix::function add_int(4); bool flag=false; BOOST_TEST(add_int(arg1)(flag) == (4)); // *** End code snippet *** This call will only compile under Apple's version of clang 3.5 in C++ 11 mode when one or both of the following conditions are met; 1) The int operator()(int a) const is also defined 2) One of the following flags is defined: BOOST_RESULT_OF_TR1 BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK The program also compiles if the function signature is changed to use a const reference parameter, i.e. int operator()(const bool& flag) const. However this then means that the parameter value cannot be modified within the body of the function as required. The problem does not occur if the program is compiled using C++ 98 compatibility mode. I suspect that the problem relates to the use of boost::result_of, which uses the decltype() function to deduce function return types when compiling with C++ 11 support. " Bugs new To Be Determined phoenix Boost 1.59.0 Problem phoenix function, C++ 11, result_of