
On 3/18/2010 7:58 AM, joel falcou wrote:
Here is link to the working.cpp and not_working.cpp stand alone source file for inspection. test were done on 1.42 release.
http://www.lri.fr/~falcou/tmp/working.cpp http://www.lri.fr/~falcou/tmp/not_working.cpp
The error is :
http://www.lri.fr/~falcou/tmp/errors.txt
thanks for any pointer on this issue which, I think, is a stupid mistake on my side.
Hi Joel, This isn't a stupid mistake on your side; it's a bug in Proto. To explain: all transforms including _default take their expression parameter as ... template<class E> ... operator()(E &e) That is, the expression must either be an lvalue or a const-qualified rvalue. It's done this way to reduce the number of overloads and improve compile times. All the temporary expression objects Proto creates are const-qualified rvalues so they can be passed to transforms. Well, *almost* all, the exception being functional::make_expr and functional::unpack_expr. That's an oversight. I just fixed it on trunk. To work around your problem, you need to change line 109 of not_working.cpp to first save the result of unpack to a temporary and then pass that to rec. HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com