C++ [over.built]p4:
For every pair (T, VQ), where T is an arithmetic type other than bool, and VQ is either volatile or empty, there exist candidate operator functions of the form VQ T& operator--(VQ T&); T operator--(VQ T&, int);
The bool type is in position LastPromotedIntegralType in BuiltinOperatorOverloadBuilder::getArithmeticType::ArithmeticTypes, but addPlusPlusMinusMinusArithmeticOverloads() is expecting it at position 0.
Original patch by Ettore Speziale.
rdar://problem/34255516
Looks like p3 for lr-- is a typo because p3 is about ++ while p4 is about --. It means the existing test didn't catch this bug. Not sure that adding another positive test will reliably prevent a regression in the future. Currently FloatRef is the type to expose the bug because FloatTy is the first type in ArithmeticTypes.
What if we add a negative test? I.e. something that would fail like
Also we can improve testing for p3 and test that BoolRef does support increment.