diff --git a/.appveyor.yml b/.appveyor.yml index e60c5de7083..dfce3321421 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ image: - - Visual Studio 2013 + - Visual Studio 2015 - Visual Studio 2022 platform: x64 @@ -16,9 +16,9 @@ for: - matrix: only: - - image: Visual Studio 2013 + - image: Visual Studio 2015 before_build: - - COPY .appveyor\VS2013.props .\Build.props + - COPY .appveyor\VS2015.props .\Build.props test_script: - .\test-suite\bin\QuantLib-test-suite-x64-mt.exe --log_level=message --build_info=yes -- --faster - diff --git a/.appveyor/VS2013.props b/.appveyor/VS2015.props similarity index 66% rename from .appveyor/VS2013.props rename to .appveyor/VS2015.props index a6a5668d78d..a4b27ad3832 100644 --- a/.appveyor/VS2013.props +++ b/.appveyor/VS2015.props @@ -4,10 +4,10 @@ - C:\Libraries\boost_1_58_0;%(AdditionalIncludeDirectories) + C:\Libraries\boost_1_69_0;%(AdditionalIncludeDirectories) - C:\Libraries\boost_1_58_0\lib64-msvc-12.0;%(AdditionalLibraryDirectories) + C:\Libraries\boost_1_69_0\lib64-msvc-14.0;%(AdditionalLibraryDirectories) diff --git a/ql/config.msvc.hpp b/ql/config.msvc.hpp index e731ae40129..ef0e22da753 100644 --- a/ql/config.msvc.hpp +++ b/ql/config.msvc.hpp @@ -25,8 +25,8 @@ #include // first things first -#if (_MSC_VER < 1800) -# error "versions of Visual C++ prior to VC++12.0 (2013) are no longer supported" +#if (_MSC_VER < 1900) +# error "versions of Visual C++ prior to VC++ 2015 are no longer supported" #endif /******************************************* @@ -47,9 +47,6 @@ // conditionally work around compiler glitches #define QL_PATCH_MSVC -#if (_MSC_VER < 1900) -# define QL_PATCH_MSVC_2013 -#endif // Compilation on the x64 platform throws a lot of warnings assigning // QuantLib::Size == size_t (64 bit) to QuantLib::Integer == int (32 diff --git a/ql/errors.cpp b/ql/errors.cpp index 3aa9676fbae..aa6b0081b49 100644 --- a/ql/errors.cpp +++ b/ql/errors.cpp @@ -97,6 +97,6 @@ namespace QuantLib { format(file, line, function, message)); } - const char* Error::what() const QL_NOEXCEPT { return message_->c_str(); } + const char* Error::what() const noexcept { return message_->c_str(); } } diff --git a/ql/errors.hpp b/ql/errors.hpp index 8019eba3252..96966e4fde8 100644 --- a/ql/errors.hpp +++ b/ql/errors.hpp @@ -45,14 +45,8 @@ namespace QuantLib { long line, const std::string& functionName, const std::string& message = ""); - #ifdef QL_PATCH_MSVC_2013 - /*! the automatically generated destructor would - not have the throw specifier. - */ - ~Error() throw() override {} - #endif //! returns the error message. - const char* what() const QL_NOEXCEPT override; + const char* what() const noexcept override; private: ext::shared_ptr message_; @@ -76,27 +70,17 @@ namespace QuantLib { #endif -/* on MSVC++13 the do { ... } while(false) construct fails inside a - for loop without brackets, so we use a dangling else instead */ -#if defined(QL_PATCH_MSVC_2013) -#define QL_MULTILINE_ASSERTION_BEGIN -#else #define QL_MULTILINE_ASSERTION_BEGIN do { -#endif /* Disable warning C4127 (conditional expression is constant) when wrapping macros with the do { ... } while(false) construct on MSVC */ #if defined(BOOST_MSVC) - #if defined(QL_PATCH_MSVC_2013) - #define QL_MULTILINE_ASSERTION_END else - #else #define QL_MULTILINE_ASSERTION_END \ __pragma(warning(push)) \ __pragma(warning(disable:4127)) \ } while(false) \ __pragma(warning(pop)) - #endif #else #define QL_MULTILINE_ASSERTION_END } while(false) #endif diff --git a/ql/experimental/exoticoptions/analyticholderextensibleoptionengine.cpp b/ql/experimental/exoticoptions/analyticholderextensibleoptionengine.cpp index 401b3baf5c9..fb1bdf99879 100644 --- a/ql/experimental/exoticoptions/analyticholderextensibleoptionengine.cpp +++ b/ql/experimental/exoticoptions/analyticholderextensibleoptionengine.cpp @@ -65,7 +65,7 @@ namespace QuantLib { //calculate payoff discount factor assuming continuous compounding DiscountFactor discount = riskFreeDiscount(t1); Real result = 0; - QL_CONSTEXPR Real minusInf = -std::numeric_limits::infinity(); + constexpr Real minusInf = -std::numeric_limits::infinity(); Real y1 = this->y1(payoff->optionType()), y2 = this->y2(payoff->optionType()); diff --git a/ql/math/array.hpp b/ql/math/array.hpp index 9f16bf2ec21..5c9f262bc56 100644 --- a/ql/math/array.hpp +++ b/ql/math/array.hpp @@ -64,7 +64,7 @@ namespace QuantLib { */ Array(Size size, Real value, Real increment); Array(const Array&); - Array(Array&&) QL_NOEXCEPT; + Array(Array&&) noexcept; #ifdef QL_USE_DISPOSABLE Array(const Disposable&); #endif @@ -74,7 +74,7 @@ namespace QuantLib { Array(ForwardIterator begin, ForwardIterator end); Array& operator=(const Array&); - Array& operator=(Array&&) QL_NOEXCEPT; + Array& operator=(Array&&) noexcept; #ifdef QL_USE_DISPOSABLE Array& operator=(const Disposable&); #endif @@ -244,7 +244,7 @@ namespace QuantLib { std::copy(from.begin(),from.end(),begin()); } - inline Array::Array(Array&& from) QL_NOEXCEPT + inline Array::Array(Array&& from) noexcept : data_((Real*)nullptr), n_(0) { swap(from); } @@ -313,7 +313,7 @@ namespace QuantLib { return *this; } - inline Array& Array::operator=(Array&& from) QL_NOEXCEPT { + inline Array& Array::operator=(Array&& from) noexcept { swap(from); return *this; } diff --git a/ql/math/matrix.hpp b/ql/math/matrix.hpp index 40832be8628..3c7f015aae1 100644 --- a/ql/math/matrix.hpp +++ b/ql/math/matrix.hpp @@ -55,14 +55,14 @@ namespace QuantLib { template Matrix(Size rows, Size columns, Iterator begin, Iterator end); Matrix(const Matrix&); - Matrix(Matrix&&) QL_NOEXCEPT; + Matrix(Matrix&&) noexcept; #ifdef QL_USE_DISPOSABLE Matrix(const Disposable&); #endif Matrix(std::initializer_list>); Matrix& operator=(const Matrix&); - Matrix& operator=(Matrix&&) QL_NOEXCEPT; + Matrix& operator=(Matrix&&) noexcept; #ifdef QL_USE_DISPOSABLE Matrix& operator=(const Disposable&); #endif @@ -228,7 +228,7 @@ namespace QuantLib { std::copy(from.begin(),from.end(),begin()); } - inline Matrix::Matrix(Matrix&& from) QL_NOEXCEPT + inline Matrix::Matrix(Matrix&& from) noexcept : data_((Real*)nullptr) { swap(from); } @@ -262,7 +262,7 @@ namespace QuantLib { return *this; } - inline Matrix& Matrix::operator=(Matrix&& from) QL_NOEXCEPT { + inline Matrix& Matrix::operator=(Matrix&& from) noexcept { swap(from); return *this; } diff --git a/ql/math/matrixutilities/svd.cpp b/ql/math/matrixutilities/svd.cpp index ed1e57a3848..375bdf0aca2 100644 --- a/ql/math/matrixutilities/svd.cpp +++ b/ql/math/matrixutilities/svd.cpp @@ -514,7 +514,7 @@ namespace QuantLib { } Size SVD::rank() const { - QL_CONSTEXPR Real eps = QL_EPSILON; + constexpr Real eps = QL_EPSILON; Real tol = m_*s_[0]*eps; Size r = 0; for (double i : s_) { diff --git a/ql/methods/finitedifferences/operators/ninepointlinearop.hpp b/ql/methods/finitedifferences/operators/ninepointlinearop.hpp index f3402f36289..7a1f122368d 100644 --- a/ql/methods/finitedifferences/operators/ninepointlinearop.hpp +++ b/ql/methods/finitedifferences/operators/ninepointlinearop.hpp @@ -42,12 +42,12 @@ namespace QuantLib { NinePointLinearOp(Size d0, Size d1, const ext::shared_ptr& mesher); NinePointLinearOp(const NinePointLinearOp& m); - NinePointLinearOp(NinePointLinearOp&& m) QL_NOEXCEPT; + NinePointLinearOp(NinePointLinearOp&& m) noexcept; #ifdef QL_USE_DISPOSABLE NinePointLinearOp(const Disposable& m); #endif NinePointLinearOp& operator=(const NinePointLinearOp& m); - NinePointLinearOp& operator=(NinePointLinearOp&& m) QL_NOEXCEPT; + NinePointLinearOp& operator=(NinePointLinearOp&& m) noexcept; #ifdef QL_USE_DISPOSABLE NinePointLinearOp& operator=(const Disposable& m); #endif @@ -83,7 +83,7 @@ namespace QuantLib { }; - inline NinePointLinearOp::NinePointLinearOp(NinePointLinearOp&& m) QL_NOEXCEPT { + inline NinePointLinearOp::NinePointLinearOp(NinePointLinearOp&& m) noexcept { swap(m); } @@ -93,7 +93,7 @@ namespace QuantLib { return *this; } - inline NinePointLinearOp& NinePointLinearOp::operator=(NinePointLinearOp&& m) QL_NOEXCEPT { + inline NinePointLinearOp& NinePointLinearOp::operator=(NinePointLinearOp&& m) noexcept { swap(m); return *this; } diff --git a/ql/methods/finitedifferences/operators/triplebandlinearop.hpp b/ql/methods/finitedifferences/operators/triplebandlinearop.hpp index c1bc97db75e..41f8fafe6bb 100644 --- a/ql/methods/finitedifferences/operators/triplebandlinearop.hpp +++ b/ql/methods/finitedifferences/operators/triplebandlinearop.hpp @@ -43,12 +43,12 @@ namespace QuantLib { const ext::shared_ptr& mesher); TripleBandLinearOp(const TripleBandLinearOp& m); - TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT; + TripleBandLinearOp(TripleBandLinearOp&& m) noexcept; #ifdef QL_USE_DISPOSABLE TripleBandLinearOp(const Disposable& m); #endif TripleBandLinearOp& operator=(const TripleBandLinearOp& m); - TripleBandLinearOp& operator=(TripleBandLinearOp&& m) QL_NOEXCEPT; + TripleBandLinearOp& operator=(TripleBandLinearOp&& m) noexcept; #ifdef QL_USE_DISPOSABLE TripleBandLinearOp& operator=(const Disposable& m); #endif @@ -90,7 +90,7 @@ namespace QuantLib { }; - inline TripleBandLinearOp::TripleBandLinearOp(TripleBandLinearOp&& m) QL_NOEXCEPT { + inline TripleBandLinearOp::TripleBandLinearOp(TripleBandLinearOp&& m) noexcept { swap(m); } @@ -100,7 +100,7 @@ namespace QuantLib { return *this; } - inline TripleBandLinearOp& TripleBandLinearOp::operator=(TripleBandLinearOp&& m) QL_NOEXCEPT { + inline TripleBandLinearOp& TripleBandLinearOp::operator=(TripleBandLinearOp&& m) noexcept { swap(m); return *this; } diff --git a/ql/methods/finitedifferences/tridiagonaloperator.hpp b/ql/methods/finitedifferences/tridiagonaloperator.hpp index 393dc2a0e72..75b6b017b81 100644 --- a/ql/methods/finitedifferences/tridiagonaloperator.hpp +++ b/ql/methods/finitedifferences/tridiagonaloperator.hpp @@ -69,12 +69,12 @@ namespace QuantLib { const Array& mid, const Array& high); TridiagonalOperator(const TridiagonalOperator&) = default; - TridiagonalOperator(TridiagonalOperator&&) QL_NOEXCEPT; + TridiagonalOperator(TridiagonalOperator&&) noexcept; #ifdef QL_USE_DISPOSABLE TridiagonalOperator(const Disposable&); #endif TridiagonalOperator& operator=(const TridiagonalOperator&); - TridiagonalOperator& operator=(TridiagonalOperator&&) QL_NOEXCEPT; + TridiagonalOperator& operator=(TridiagonalOperator&&) noexcept; #ifdef QL_USE_DISPOSABLE TridiagonalOperator& operator=(const Disposable&); #endif @@ -136,7 +136,7 @@ namespace QuantLib { // inline definitions - inline TridiagonalOperator::TridiagonalOperator(TridiagonalOperator&& from) QL_NOEXCEPT { + inline TridiagonalOperator::TridiagonalOperator(TridiagonalOperator&& from) noexcept { swap(from); } @@ -155,7 +155,7 @@ namespace QuantLib { } inline TridiagonalOperator& - TridiagonalOperator::operator=(TridiagonalOperator&& from) QL_NOEXCEPT { + TridiagonalOperator::operator=(TridiagonalOperator&& from) noexcept { swap(from); return *this; } diff --git a/ql/pricingengines/asian/mc_discr_geom_av_price.cpp b/ql/pricingengines/asian/mc_discr_geom_av_price.cpp index 70bbc664ce9..1516fd333ea 100644 --- a/ql/pricingengines/asian/mc_discr_geom_av_price.cpp +++ b/ql/pricingengines/asian/mc_discr_geom_av_price.cpp @@ -43,7 +43,7 @@ namespace QuantLib { product *= path.front(); } // care must be taken not to overflow product - QL_CONSTEXPR Real maxValue = QL_MAX_REAL; + constexpr Real maxValue = QL_MAX_REAL; averagePrice = 1.0; for (Size i=1; i::epsilon(); + constexpr Real accuracy = std::numeric_limits::epsilon(); return solver.solve([&](Volatility _v) { return blackValue(payoff.optionType(), strike, fwd, t, _v, df, npv); }, diff --git a/ql/utilities/clone.hpp b/ql/utilities/clone.hpp index 7cc2b3efdde..19b269c0032 100644 --- a/ql/utilities/clone.hpp +++ b/ql/utilities/clone.hpp @@ -50,10 +50,10 @@ namespace QuantLib { #endif Clone(const T&); Clone(const Clone&); - Clone(Clone&&) QL_NOEXCEPT; + Clone(Clone&&) noexcept; Clone& operator=(const T&); Clone& operator=(const Clone&); - Clone& operator=(Clone&&) QL_NOEXCEPT; + Clone& operator=(Clone&&) noexcept; T& operator*() const; T* operator->() const; bool empty() const; @@ -88,7 +88,7 @@ namespace QuantLib { : ptr_(t.empty() ? (T*)nullptr : t->clone().release()) {} template - inline Clone::Clone(Clone&& t) QL_NOEXCEPT { + inline Clone::Clone(Clone&& t) noexcept { swap(t); } @@ -109,7 +109,7 @@ namespace QuantLib { } template - inline Clone& Clone::operator=(Clone&& t) QL_NOEXCEPT { + inline Clone& Clone::operator=(Clone&& t) noexcept { swap(t); return *this; } diff --git a/test-suite/array.cpp b/test-suite/array.cpp index 8c789a707df..21c0d187ea5 100644 --- a/test-suite/array.cpp +++ b/test-suite/array.cpp @@ -192,13 +192,13 @@ void ArrayTest::testArrayFunctions() { a[i] = std::sin(Real(i))+1.1; } - QL_CONSTEXPR Real exponential = -2.3; + constexpr Real exponential = -2.3; const Array p = Pow(a, exponential); const Array e = Exp(a); const Array l = Log(a); const Array s = Sqrt(a); - QL_CONSTEXPR Real tol = 10*QL_EPSILON; + constexpr Real tol = 10*QL_EPSILON; for (Size i=0; i < a.size(); ++i) { if (std::fabs(p[i]-std::pow(a[i], exponential)) > tol) { BOOST_FAIL("Array function test Pow failed"); diff --git a/test-suite/bermudanswaption.cpp b/test-suite/bermudanswaption.cpp index 2cae2f8b8ad..17478fa5fef 100644 --- a/test-suite/bermudanswaption.cpp +++ b/test-suite/bermudanswaption.cpp @@ -354,7 +354,7 @@ void BermudanSwaptionTest::testTreeEngineTimeSnapping() { bermudanSwaption->setPricingEngine(ext::make_shared(model)); auto npvFD = bermudanSwaption->NPV(); - QL_CONSTEXPR auto timesteps = 14 * 4 * 4; + constexpr auto timesteps = 14 * 4 * 4; bermudanSwaption->setPricingEngine( ext::make_shared(model, timesteps)); diff --git a/test-suite/cmsspread.cpp b/test-suite/cmsspread.cpp index 1f5c96bdeae..8aa06bed0c8 100644 --- a/test-suite/cmsspread.cpp +++ b/test-suite/cmsspread.cpp @@ -219,9 +219,9 @@ void CmsSpreadTest::testCouponPricing() { cpn1->setPricer(d.cmsspPricerLn); #ifndef __FAST_MATH__ - QL_CONSTEXPR Real eqTol = 100*QL_EPSILON; + constexpr Real eqTol = 100*QL_EPSILON; #else - QL_CONSTEXPR Real eqTol = 1e-13; + constexpr Real eqTol = 1e-13; #endif BOOST_CHECK_CLOSE(cpn1->rate(), cpn1a->rate() - cpn1b->rate(), eqTol); cms10y->addFixing(d.refDate, 0.05); diff --git a/test-suite/fdmlinearop.cpp b/test-suite/fdmlinearop.cpp index 1e216c9d58f..acbc6428750 100644 --- a/test-suite/fdmlinearop.cpp +++ b/test-suite/fdmlinearop.cpp @@ -230,7 +230,7 @@ void FdmLinearOpTest::testUniformGridMesher() { const Real dx2 = 95.0/(dim[1]-1); const Real dx3 = 10.0/(dim[2]-1); - QL_CONSTEXPR Real tol = 100*QL_EPSILON; + constexpr Real tol = 100*QL_EPSILON; if ( std::fabs(dx1-mesher.dminus(layout->begin(),0)) > tol || std::fabs(dx1-mesher.dplus(layout->begin(),0)) > tol || std::fabs(dx2-mesher.dminus(layout->begin(),1)) > tol @@ -1680,7 +1680,7 @@ void FdmLinearOpTest::testLowVolatilityHighDiscreteDividendBlackScholesMesher() const Real calculatedMin = std::exp(loc.front()); - QL_CONSTEXPR Real relTol = 1e5*QL_EPSILON; + constexpr Real relTol = 1e5*QL_EPSILON; const Real maxDiff = std::fabs(calculatedMax - maximum); if (maxDiff > relTol*maximum) { diff --git a/test-suite/hestonmodel.cpp b/test-suite/hestonmodel.cpp index 9998827bdd5..1ac529afd72 100644 --- a/test-suite/hestonmodel.cpp +++ b/test-suite/hestonmodel.cpp @@ -2047,7 +2047,7 @@ void HestonModelTest::testCharacteristicFct() { const COSHestonEngine cosEngine(model); const AnalyticHestonEngine analyticEngine(model); - QL_CONSTEXPR Real tol = 100*QL_EPSILON; + constexpr Real tol = 100*QL_EPSILON; for (double i : u) { for (double j : t) { const std::complex c = cosEngine.chF(i, j); @@ -2422,7 +2422,7 @@ void HestonModelTest::testPiecewiseTimeDependentChFvsHestonChF() { TimeGrid(dayCounter.yearFraction(settlementDate, maturityDate), 10)))); - QL_CONSTEXPR Real tol = 100*QL_EPSILON; + constexpr Real tol = 100*QL_EPSILON; for (Real r = 0.1; r < 4; r+=0.25) { for (Real phi = 0; phi < 360; phi+=60) { for (Time t=0.1; t <= 1.0; t+=0.3) { diff --git a/test-suite/interpolations.cpp b/test-suite/interpolations.cpp index a7a5bfa4e5c..a8518dbf553 100644 --- a/test-suite/interpolations.cpp +++ b/test-suite/interpolations.cpp @@ -2191,7 +2191,7 @@ void InterpolationTest::testLagrangeInterpolation() { 0.5130076920869246 }; - QL_CONSTEXPR Real tol = 50*QL_EPSILON; + constexpr Real tol = 50*QL_EPSILON; for (Size i=0; i < 79; ++i) { const Real xx = -1.0 + i*0.025; const Real calculated = interpl(xx); diff --git a/test-suite/matrices.cpp b/test-suite/matrices.cpp index 8c3696fc921..daf685e5b8a 100644 --- a/test-suite/matrices.cpp +++ b/test-suite/matrices.cpp @@ -593,7 +593,7 @@ void MatricesTest::testMoorePenroseInverse() { Real cached[6] = {1.153846153846152, 1.461538461538463, 1.384615384615384, 1.384615384615385, 1.461538461538462, 1.153846153846152}; - QL_CONSTEXPR Real tol = 500.0 * QL_EPSILON; + constexpr Real tol = 500.0 * QL_EPSILON; for (Size i = 0; i < 6; ++i) { if (std::abs(x[i] - cached[i]) > tol) { @@ -606,7 +606,7 @@ void MatricesTest::testMoorePenroseInverse() { } Array y = A*x; - QL_CONSTEXPR Real tol2 = 2000.0 * QL_EPSILON; + constexpr Real tol2 = 2000.0 * QL_EPSILON; for (Size i = 0; i < 6; ++i) { if (std::abs(y[i] - 260.0) > tol2) { BOOST_FAIL( @@ -648,7 +648,7 @@ void MatricesTest::testIterativeSolvers() { Array b(3); b[0] = 1.0; b[1] = 0.5; b[2] = 3.0; - QL_CONSTEXPR Real relTol = 1e4*QL_EPSILON; + constexpr Real relTol = 1e4*QL_EPSILON; const Array x = BiCGstab(MatrixMult(M1), 3, relTol).solve(b).x; if (norm2(M1*x-b)/norm2(b) > relTol) { diff --git a/test-suite/normalclvmodel.cpp b/test-suite/normalclvmodel.cpp index 73503996fb3..8f0ca44b47a 100644 --- a/test-suite/normalclvmodel.cpp +++ b/test-suite/normalclvmodel.cpp @@ -81,7 +81,7 @@ void NormalCLVModelTest::testBSCumlativeDistributionFunction() { const BSMRNDCalculator rndCalculator(bsProcess); - QL_CONSTEXPR Real tol = 1e5*QL_EPSILON; + constexpr Real tol = 1e5*QL_EPSILON; const Time t = dc.yearFraction(today, maturity); for (Real x=10; x < 400; x+=10) { const Real calculated = m.cdf(maturity, x); diff --git a/test-suite/numericaldifferentiation.cpp b/test-suite/numericaldifferentiation.cpp index 1fd8e8cf166..7b506db6337 100644 --- a/test-suite/numericaldifferentiation.cpp +++ b/test-suite/numericaldifferentiation.cpp @@ -31,7 +31,7 @@ using namespace boost::unit_test_framework; namespace { bool isTheSame(Real a, Real b) { - QL_CONSTEXPR Real eps = 500*QL_EPSILON; + constexpr Real eps = 500*QL_EPSILON; if (std::fabs(b) < QL_EPSILON) return std::fabs(a) < eps; diff --git a/test-suite/ode.cpp b/test-suite/ode.cpp index 74c41668658..baded69c506 100644 --- a/test-suite/ode.cpp +++ b/test-suite/ode.cpp @@ -197,8 +197,8 @@ void OdeTest::testMatrixExponentialOfZero() { Matrix m(3, 3, 0.0); - QL_CONSTEXPR Real tol = 100*QL_EPSILON; - QL_CONSTEXPR Time t=1.0; + constexpr Real tol = 100*QL_EPSILON; + constexpr Time t=1.0; const Matrix calculated = Expm(m, t); for (Size i=0; i < calculated.rows(); ++i) {