The yield to maturity (YTM) of a bond is the IRR that a buyer would receive if they purchased the bond at the current market price. This is also called the redemption yield.
As an IRR measure, YTM suffers from the same flaws. The flaws are less serious in this case, because of the characteristics of bonds: cash flows are always positive, and the variation in the rates at which income can be re-invested is lower.
YTM is, nonetheless, generally a much better measure than flat yield, and is probably the most accurate of the commonly used measures of bond yield. A full evaluation of a bond needs to consider whether the yield spread is sufficient compensation for risk, and how it compares with alternatives over the same term.
YTM is also needs to be adjusted for callable bonds.
The calculation of yield to maturity for index linked government bonds is made more complex by the need to make assumptions about inflation in order to make the YTM comparable with other bonds.
Any other type of bond that has uncertain cash flows will need similar adjustments.