lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master b6916ab8 5/5: Avoid deprecated enum conversio


From: Greg Chicares
Subject: [lmi-commits] [lmi] master b6916ab8 5/5: Avoid deprecated enum conversions
Date: Fri, 3 Jun 2022 09:45:12 -0400 (EDT)

branch: master
commit b6916ab8ef95cbe32dda38aeeb02a34b30c7e3a3
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Avoid deprecated enum conversions
    
    Incidentally, this revision makes a case for 'a_'-prefixed arguments.
---
 configure.ac       |  3 ---
 ihs_basicval.cpp   | 23 +++++++++++++++--------
 pdf_command_wx.cpp | 13 +++++++------
 workhorse.make     |  1 -
 4 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index b9e3f643..c37c6b5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -537,9 +537,6 @@ if test "x$GXX" == "xyes"; then
         LMI_CXX_ADD_IF_SUPPORTED(-Wno-parentheses)
     fi
 
-    dnl This warning is given by both gcc and clang in C++20 mode and can't be
-    dnl easily avoided, so disable it for now.
-    LMI_CXX_ADD_IF_SUPPORTED(-Wno-deprecated-enum-float-conversion)
     if test "$CLANG" = "yes"; then
         dnl These warnings are clang-specific but also can't be easily fixed.
         LMI_CXX_ADD_IF_SUPPORTED(-Wno-deprecated-anon-enum-enum-conversion)
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 9dadcd63..0d09a9db 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -1003,12 +1003,13 @@ currency BasicValues::GetModalPremProxyTable
     ,double      a_table_multiplier
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     return round_gross_premium().c
         (
           a_specamt
         * MortalityRates_->GroupProxyRates()[a_year]
         * a_table_multiplier
-        / a_mode
+        / mode
         );
 }
 
@@ -1024,6 +1025,7 @@ currency BasicValues::GetModalPremCorridor
     ,currency    a_specamt
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     double const rate = GetCorridorFactor()[0];
     int const k = round_corridor_factor().decimals();
     double const s = bin_exp(10.0, k);
@@ -1031,7 +1033,7 @@ currency BasicValues::GetModalPremCorridor
     // lmi generally expects rounding to nearest everywhere.
     std::fesetround(FE_TONEAREST);
     double const z = std::nearbyint(s * rate);
-    return round_max_premium().c((a_specamt / z) * s / a_mode);
+    return round_max_premium().c((a_specamt / z) * s / mode);
 }
 
 //============================================================================
@@ -1042,6 +1044,7 @@ currency BasicValues::GetModalPremGLP
     ,currency    a_specamt
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     // TAXATION !! Use GetAnnualTgtPrem() to get target here if needed
     // for GPT reimplementation.
     double z = Irc7702_->CalculateGLP
@@ -1056,7 +1059,7 @@ currency BasicValues::GetModalPremGLP
 // what if a_year != 0 ?
 // term rider, dumpin
 
-    z /= a_mode;
+    z /= mode;
     return round_max_premium().c(z);
 }
 
@@ -1068,6 +1071,7 @@ currency BasicValues::GetModalPremGSP
     ,currency    a_specamt
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     double z = Irc7702_->CalculateGSP
         (a_duration
         ,dblize(a_bft_amt)
@@ -1079,7 +1083,7 @@ currency BasicValues::GetModalPremGSP
 // what if a_year != 0 ?
 // term rider, dumpin
 
-    z /= a_mode;
+    z /= mode;
     return round_max_premium().c(z);
 }
 
@@ -1094,8 +1098,9 @@ currency BasicValues::GetModalPremGSP
 /// may not prevent the contract from lapsing; both those outcomes are
 /// likely to frustrate customers.
 
-double BasicValues::mly_ded_discount_factor(int year, mcenum_mode mode) const
+double BasicValues::mly_ded_discount_factor(int year, mcenum_mode a_mode) const
 {
+    auto const mode = static_cast<int>(a_mode);
     LMI_ASSERT(0.0 != mode);
     double spread = 0.0;
     if(mce_monthly != mode)
@@ -1315,14 +1320,15 @@ std::pair<double,double> BasicValues::approx_mly_ded_ex
 
 currency BasicValues::GetModalPremMlyDed
     (int         year
-    ,mcenum_mode mode
+    ,mcenum_mode a_mode
     ,currency    specamt
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     auto const deductions = approx_mly_ded(year, specamt);
     double const ann_ded = deductions.first;
     double const mly_ded = deductions.second;
-    double const v12 = mly_ded_discount_factor(year, mode);
+    double const v12 = mly_ded_discount_factor(year, a_mode);
     double const annuity = (1.0 - std::pow(v12, 12.0 / mode)) / (1.0 - v12);
     return round_min_premium().c(ann_ded + mly_ded * annuity);
 }
@@ -1331,11 +1337,12 @@ currency BasicValues::GetModalPremMlyDed
 
 std::pair<currency,currency> BasicValues::GetModalPremMlyDedEx
     (int         year
-    ,mcenum_mode mode
+    ,mcenum_mode a_mode
     ,currency    specamt
     ,currency    termamt
     ) const
 {
+    auto const mode = static_cast<int>(a_mode);
     auto const deductions = approx_mly_ded_ex(year, specamt, termamt);
     double const ee_ded = deductions.first;
     double const er_ded = deductions.second;
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index 1d9c2d51..f3e11749 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -2207,26 +2207,27 @@ class pdf_illustration_naic : public pdf_illustration
         add_abbreviated_variable("CorpName", 50);
         add_abbreviated_variable("Insured1", 50);
 
+        auto const is_single_premium = bourn_cast<int>(invar.IsSinglePremium);
         add_variable
             ("SinglePremium"
-            ,     oe_plain_single_premium     == invar.IsSinglePremium
-               || oe_modified_single_premium  == invar.IsSinglePremium
-               || oe_limited_flexible_premium == invar.IsSinglePremium
+            ,     oe_plain_single_premium     == is_single_premium
+               || oe_modified_single_premium  == is_single_premium
+               || oe_limited_flexible_premium == is_single_premium
             );
 
         add_variable
             ("PlainSinglePremium"
-            ,oe_plain_single_premium     == invar.IsSinglePremium
+            ,oe_plain_single_premium     == is_single_premium
             );
 
         add_variable
             ("ModifiedSinglePremium"
-            ,oe_modified_single_premium  == invar.IsSinglePremium
+            ,oe_modified_single_premium  == is_single_premium
             );
 
         add_variable
             ("LimitedFlexiblePremium"
-            ,oe_limited_flexible_premium == invar.IsSinglePremium
+            ,oe_limited_flexible_premium == is_single_premium
             );
 
         // Lowercase initial payment mode with prepended indefinite
diff --git a/workhorse.make b/workhorse.make
index 9f427373..234ae2ae 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -504,7 +504,6 @@ else ifneq (,$(filter $(gcc_version), 11 11.0))
   gcc_version_specific_c_warnings :=
 
   gcc_version_specific_cxx_warnings := \
-    -Wno-deprecated-enum-float-conversion \
     -Wredundant-tags \
     -Wvolatile \
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]