diff --git a/ql/cashflows/subperiodcoupon.cpp b/ql/cashflows/subperiodcoupon.cpp index 26c8bdddf8..f28c4cf50f 100644 --- a/ql/cashflows/subperiodcoupon.cpp +++ b/ql/cashflows/subperiodcoupon.cpp @@ -346,6 +346,8 @@ namespace QuantLib { } + QL_DEPRECATED_DISABLE_WARNING + SubPeriodsLeg::SubPeriodsLeg(Schedule schedule, ext::shared_ptr i) : schedule_(std::move(schedule)), index_(std::move(i)), paymentCalendar_(schedule_.calendar()) { QL_REQUIRE(index_, "no index provided"); @@ -474,14 +476,12 @@ namespace QuantLib { paymentDate, -exCouponPeriod_, exCouponAdjustment_, exCouponEndOfMonth_); } } - QL_DEPRECATED_DISABLE_WARNING cashflows.push_back(ext::shared_ptr(new SubPeriodsCoupon( paymentDate, detail::get(notionals_, i, notionals_.back()), start, end, detail::get(fixingDays_, i, index_->fixingDays()), index_, detail::get(gearings_, i, 1.0), detail::get(couponSpreads_, i, 0.0), detail::get(rateSpreads_, i, 0.0), refStart, refEnd, paymentDayCounter_, exCouponDate))); - QL_DEPRECATED_ENABLE_WARNING } switch (averagingMethod_) { @@ -499,4 +499,6 @@ namespace QuantLib { return cashflows; } + QL_DEPRECATED_ENABLE_WARNING + } diff --git a/ql/instruments/zerocouponswap.cpp b/ql/instruments/zerocouponswap.cpp index 0fd5919e17..92eea77a7d 100644 --- a/ql/instruments/zerocouponswap.cpp +++ b/ql/instruments/zerocouponswap.cpp @@ -33,8 +33,16 @@ namespace QuantLib { const Date& maturityDate, Real nominal, const ext::shared_ptr& index) { + Schedule schedule = MakeSchedule() + .from(startDate) + .to(maturityDate) + .withTenor(index->tenor()) + .withCalendar(index->fixingCalendar()) + .withConvention(index->businessDayConvention()) + .backwards() + .endOfMonth(index->endOfMonth()); auto floatCpn = ext::make_shared( - paymentDate, nominal, startDate, maturityDate, index->fixingDays(), index); + paymentDate, nominal, schedule, index->fixingDays(), index); floatCpn->setPricer( ext::shared_ptr(new CompoundingRatePricer)); return floatCpn; diff --git a/test-suite/subperiodcoupons.cpp b/test-suite/subperiodcoupons.cpp index 3c8dc60b2b..11a8b61c5a 100644 --- a/test-suite/subperiodcoupons.cpp +++ b/test-suite/subperiodcoupons.cpp @@ -290,6 +290,8 @@ BOOST_AUTO_TEST_CASE(testSubPeriodsLegConsistencyChecks) { Date start(18, March, 2021); Date end(18, March, 2031); + QL_DEPRECATED_DISABLE_WARNING + Leg validLeg = vars.createSubPeriodsLeg(start, end); Size N = validLeg.size(); @@ -326,6 +328,7 @@ BOOST_AUTO_TEST_CASE(testSubPeriodsLegConsistencyChecks) { .withRateSpreads(std::vector(N + 1, 0.0))), Error); + QL_DEPRECATED_ENABLE_WARNING }