I am running one of those XT rear derailleurs on my 71 Raleigh International* with an 11-40 cassette and it shifts it just fine. I am going to switch it to a 11-34 or 11-36, though. I had planned to run a double 48-38 in the front and then Sloar started his crazy sales and I ended up with an SR Suntour Superbe triple crank with a 24t small gear. I don't need the 40 with that.
*Based on the picture, I think the OP's derailleur hanger is not as long as the one on my International.
__________________
Andy