2
0
mirror of https://github.com/boostorg/phoenix.git synced 2026-02-18 14:22:09 +00:00

scope/let.hpp use ASSERT to make sure size(vars) is accessed.

This commit is contained in:
John Fletcher
2015-01-09 00:06:22 +00:00
parent 02fd12629a
commit 086d8e52a5

View File

@@ -9,6 +9,8 @@
#ifndef BOOST_PHOENIX_SCOPE_LET_HPP
#define BOOST_PHOENIX_SCOPE_LET_HPP
#include <boost/assert.hpp>
#include <sstream>
#include <boost/phoenix/core/limits.hpp>
#include <boost/fusion/include/transform.hpp>
#include <boost/fusion/include/as_vector.hpp>
@@ -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)));
}
};