If there is bad weather, 40 mins can be very tight.
My YOW-YYZ-ATL Sunday was a bit of a mess due to bad weather. YOW-YYZ was over 1hr late leaving due to late incoming aircraft due to weather isuses as well as de-icing. YYZ-ATL was 1.5 hour late leaving due to late arriving flight due to bad weather.
I would do everything in my power to do only carry ons or your luggage might misconnect.