lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master b88a684: Work around an apparent compiler def


From: Greg Chicares
Subject: [lmi-commits] [lmi] master b88a684: Work around an apparent compiler defect
Date: Tue, 18 May 2021 07:22:02 -0400 (EDT)

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

    Work around an apparent compiler defect
    
    Partially reverted commit 237cf7245.
    
    Although operator""_cents() is 'consteval', msvc failed to compile a
    particular expression that used it with the ternary operator. See:
      https://lists.nongnu.org/archive/html/lmi/2021-05/msg00040.html
---
 ihs_avsolve.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index ed12df6..3adca83 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -249,7 +249,8 @@ currency AccountValue::SolveTest(currency a_CandidateValue)
 
     if(mce_solve_for_non_mec == SolveTarget_)
         {
-        return InvariantValues().IsMec ? -100_cents : 100_cents;
+        static constexpr currency C100 = 100_cents;
+        return InvariantValues().IsMec ? -C100 : C100;
         }
 
     return value - SolveTargetCsv_;



reply via email to

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