summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorJan Korous <jkorous@apple.com>2018-04-11 13:36:29 +0000
committerJan Korous <jkorous@apple.com>2018-04-11 13:36:29 +0000
commitd74ebe22db891a964d77082e42ad18f28d93610a (patch)
treeac88de91261c28a02343da134a56fe976d638570 /clang/lib/Sema/SemaOverload.cpp
parenta70512a9587c40e66035c53c170e8d44c8d2e911 (diff)
downloadbcm5719-llvm-d74ebe22db891a964d77082e42ad18f28d93610a.tar.gz
bcm5719-llvm-d74ebe22db891a964d77082e42ad18f28d93610a.zip
[Sema] Fix built-in decrement operator overload resolution
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() was expecting it at position 0. Differential Revision: https://reviews.llvm.org/D44988 rdar://problem/34255516 llvm-svn: 329804
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index bae2783bea5..7905f5e6228 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7796,10 +7796,12 @@ public:
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());
}
OpenPOWER on IntegriCloud