diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 4fef397f37..d2f6ee725d 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -5255,9 +5255,9 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, // contextually converted to bool long ago. The candidates below are // therefore added as binary. // - // C++ [over.built]p24: - // For every type T, where T is a pointer or pointer-to-member type, - // there exist candidate operator functions of the form + // C++ [over.built]p25: + // For every type T, where T is a pointer, pointer-to-member, or scoped + // enumeration type, there exist candidate operator functions of the form // // T operator?(bool, T, T); // @@ -5272,6 +5272,15 @@ Sema::AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, QualType ParamTypes[2] = { *Ptr, *Ptr }; AddBuiltinCandidate(*Ptr, ParamTypes, Args, 2, CandidateSet); } + if (getLangOptions().CPlusPlus0x) + for (BuiltinCandidateTypeSet::iterator Enum = + CandidateTypes.enumeration_begin(), + E = CandidateTypes.enumeration_end(); Enum != E; ++Enum) { + if (!(*Enum)->getAs<EnumType>()->getDecl()->isScoped()) + continue; + QualType ParamTypes[2] = { *Enum, *Enum }; + AddBuiltinCandidate(*Enum, ParamTypes, Args, 2, CandidateSet); + } goto Conditional; } } |