From 086d8e52a56e5c1ac435a2ff4254e7da2f49026a Mon Sep 17 00:00:00 2001 From: John Fletcher Date: Fri, 9 Jan 2015 00:06:22 +0000 Subject: [PATCH] scope/let.hpp use ASSERT to make sure size(vars) is accessed. --- include/boost/phoenix/scope/let.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/phoenix/scope/let.hpp b/include/boost/phoenix/scope/let.hpp index f1b428c..3900ef2 100644 --- a/include/boost/phoenix/scope/let.hpp +++ b/include/boost/phoenix/scope/let.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_PHOENIX_SCOPE_LET_HPP #define BOOST_PHOENIX_SCOPE_LET_HPP +#include +#include #include #include #include @@ -118,6 +120,13 @@ namespace boost { namespace phoenix > env(phoenix::env(ctx), phoenix::env(ctx), locals); + // Fix for bugs (trial) + // The idea is to do something which will not be optimised away. + int vsize = boost::fusion::size(vars); + std::stringstream strm; + strm << vsize << std::endl; + int size = strm.str().length(); + BOOST_ASSERT(size >= 0); return eval(expr, phoenix::context(env, phoenix::actions(ctx))); } };