diff --git a/triqs/gfs/block.hpp b/triqs/gfs/block.hpp index cd36b724..415983c3 100644 --- a/triqs/gfs/block.hpp +++ b/triqs/gfs/block.hpp @@ -103,7 +103,8 @@ namespace gfs { // from a vector of gf (moving directly) template block_gf make_block_gf(std::vector> V) { - return {{int(V.size())}, std::move(V), nothing{}, nothing{}, nothing{}}; + int s = V.size(); // DO NOT use V.size in next statement, the V is moved and the order of arg. evaluation is undefined. + return {{s}, std::move(V), nothing{}, nothing{}, nothing{}}; } // from a vector of gf : generalized to have a different type of gf in the vector (e.g. views...) @@ -154,7 +155,8 @@ namespace gfs { } template gf_view make_block_gf_view_from_vector(std::vector V) { - return {{int(V.size())}, std::move(V), nothing{}, nothing{}, nothing{}}; + int s = V.size(); + return {{s}, std::move(V), nothing{}, nothing{}, nothing{}}; } template