Skip to content

Commit

Permalink
Work around problem on msvc-12/14 in release mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
swatanabe committed Nov 6, 2017
1 parent 2b4779f commit 87477f5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/boost/random/linear_congruential.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,12 @@ class linear_congruential_engine
* distinct seeds in the range [1,m) will leave the generator in distinct
* states. If c is not zero, the range is [0,m).
*/
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_congruential_engine, IntType, x0)
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_congruential_engine, IntType, x0_)
{
// Work around a msvc 12/14 optimizer bug, which causes
// the line _x = 1 to run unconditionally sometimes.
// Creating a local copy seems to make it work.
IntType x0 = x0_;
// wrap _x if it doesn't fit in the destination
if(modulus == 0) {
_x = x0;
Expand Down

0 comments on commit 87477f5

Please sign in to comment.