From ed2807f4cd9f1beaa1b4f0deac28279e02718bb9 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 21 Apr 2009 11:42:51 +0000 Subject: [PATCH] =?UTF-8?q?re=20PR=20libstdc++/39835=20(Bootstrap=20failur?= =?UTF-8?q?e:=20libstdc++-v3/include/bits/random.h:3630:=20error:=20expect?= =?UTF-8?q?ed=20=C3=A2,=C3=A2=20or=20=C3=A2...=C3=A2=20before=20numeric=20?= =?UTF-8?q?constant)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2009-04-21 Paolo Carlini PR libstdc++/39835 * include/bits/random.h: Avoid the badname __alpha (and, for consistency, __beta too). * include/bits/random.tcc: Likewise. From-SVN: r146516 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/bits/random.h | 12 +++++------ libstdc++-v3/include/bits/random.tcc | 30 ++++++++++++++-------------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b72a0a3f80e..dcd313b3a21 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2009-04-21 Paolo Carlini + + PR libstdc++/39835 + * include/bits/random.h: Avoid the badname __alpha (and, for + consistency, __beta too). + * include/bits/random.tcc: Likewise. + 2009-04-19 Jan Hubicka * include/c_compatibility/stdatomic.h (__atomic_flag_for_address): Use diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 366105caa8f..425420607ce 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -3627,9 +3627,9 @@ namespace std friend class gamma_distribution<_RealType>; explicit - param_type(_RealType __alpha = _RealType(1), - _RealType __beta = _RealType(1)) - : _M_alpha(__alpha), _M_beta(__beta) + param_type(_RealType __alpha_val = _RealType(1), + _RealType __beta_val = _RealType(1)) + : _M_alpha(__alpha_val), _M_beta(__beta_val) { _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); _M_initialize(); @@ -3660,9 +3660,9 @@ namespace std * @f$ \alpha @f$ and @f$ \beta @f$. */ explicit - gamma_distribution(_RealType __alpha = _RealType(1), - _RealType __beta = _RealType(1)) - : _M_param(__alpha, __beta) + gamma_distribution(_RealType __alpha_val = _RealType(1), + _RealType __beta_val = _RealType(1)) + : _M_param(__alpha_val, __beta_val) { } explicit diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index 9fed72ff881..8944c116b7e 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -1921,14 +1921,14 @@ namespace std __aurng(__urng); bool __reject; - const _RealType __alpha = __param.alpha(); - const _RealType __beta = __param.beta(); - if (__alpha >= 1) + const _RealType __alpha_val = __param.alpha(); + const _RealType __beta_val = __param.beta(); + if (__alpha_val >= 1) { // alpha - log(4) - const result_type __b = __alpha + const result_type __b = __alpha_val - result_type(1.3862943611198906188344642429163531L); - const result_type __c = __alpha + __param._M_l_d; + const result_type __c = __alpha_val + __param._M_l_d; const result_type __1l = 1 / __param._M_l_d; // 1 + log(9 / 2) @@ -1936,11 +1936,11 @@ namespace std do { - const result_type __u = __aurng() / __beta; - const result_type __v = __aurng() / __beta; + const result_type __u = __aurng() / __beta_val; + const result_type __v = __aurng() / __beta_val; const result_type __y = __1l * std::log(__v / (1 - __v)); - __x = __alpha * std::exp(__y); + __x = __alpha_val * std::exp(__y); const result_type __z = __u * __v * __v; const result_type __r = __b + __c * __y - __x; @@ -1953,12 +1953,12 @@ namespace std } else { - const result_type __c = 1 / __alpha; + const result_type __c = 1 / __alpha_val; do { - const result_type __z = -std::log(__aurng() / __beta); - const result_type __e = -std::log(__aurng() / __beta); + const result_type __z = -std::log(__aurng() / __beta_val); + const result_type __e = -std::log(__aurng() / __beta_val); __x = std::pow(__z, __c); @@ -1967,7 +1967,7 @@ namespace std while (__reject); } - return __beta * __x; + return __beta_val * __x; } template @@ -2005,10 +2005,10 @@ namespace std const typename __ios_base::fmtflags __flags = __is.flags(); __is.flags(__ios_base::dec | __ios_base::skipws); - _RealType __alpha, __beta; - __is >> __alpha >> __beta; + _RealType __alpha_val, __beta_val; + __is >> __alpha_val >> __beta_val; __x.param(typename gamma_distribution<_RealType>:: - param_type(__alpha, __beta)); + param_type(__alpha_val, __beta_val)); __is.flags(__flags); return __is;