Index: lib/Sema/SemaOverload.cpp =================================================================== --- lib/Sema/SemaOverload.cpp +++ lib/Sema/SemaOverload.cpp @@ -7796,10 +7796,12 @@ if (!HasArithmeticOrEnumeralCandidateType) return; - for (unsigned Arith = (Op == OO_PlusPlus? 0 : 1); - Arith < NumArithmeticTypes; ++Arith) { + for (unsigned Arith = 0; Arith < NumArithmeticTypes; ++Arith) { + const auto TypeOfT = ArithmeticTypes[Arith]; + if (Op == OO_MinusMinus && TypeOfT == S.Context.BoolTy) + continue; addPlusPlusMinusMinusStyleOverloads( - ArithmeticTypes[Arith], + TypeOfT, VisibleTypeConversionsQuals.hasVolatile(), VisibleTypeConversionsQuals.hasRestrict()); } Index: test/SemaCXX/overloaded-builtin-operators.cpp =================================================================== --- test/SemaCXX/overloaded-builtin-operators.cpp +++ test/SemaCXX/overloaded-builtin-operators.cpp @@ -73,6 +73,10 @@ operator volatile long&(); }; +struct FloatRef { + operator float&(); +}; + struct XpmfRef { // expected-note{{candidate function (the implicit copy assignment operator) not viable}} #if __cplusplus >= 201103L // C++11 or later // expected-note@-2 {{candidate function (the implicit move assignment operator) not viable}} @@ -84,13 +88,16 @@ operator E2&(); }; -void g(ShortRef sr, LongRef lr, E2Ref e2_ref, XpmfRef pmf_ref) { +void g(ShortRef sr, LongRef lr, FloatRef fr, E2Ref e2_ref, XpmfRef pmf_ref) { // C++ [over.built]p3 short s1 = sr++; // C++ [over.built]p3 long l1 = lr--; + // C++ [over.built]p4 + float f1 = fr--; + // C++ [over.built]p18 short& sr1 = (sr *= lr); volatile long& lr1 = (lr *= sr);