diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index 728a596a92f1..c6012d754db0 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -821,7 +821,7 @@ class Sema; CallExpr::ADLCallKind IsADLCandidate : 1; /// Whether this is a rewritten candidate, and if so, of what kind? - OverloadCandidateRewriteKind RewriteKind : 2; + unsigned RewriteKind : 2; /// FailureKind - The reason why this candidate is not viable. /// Actually an OverloadFailureKind. @@ -841,6 +841,12 @@ class Sema; StandardConversionSequence FinalConversion; }; + /// Get RewriteKind value in OverloadCandidateRewriteKind type (This + /// function is to workaround the spurious GCC bitfield enum warning) + OverloadCandidateRewriteKind getRewriteKind() const { + return static_cast(RewriteKind); + } + /// hasAmbiguousConversion - Returns whether this overload /// candidate requires an ambiguous conversion or not. bool hasAmbiguousConversion() const { diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index bf520f66e3ae..a97847461e3e 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -9935,7 +9935,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, std::string FnDesc; std::pair FnKindPair = - ClassifyOverloadCandidate(S, Cand->FoundDecl, Fn, Cand->RewriteKind, + ClassifyOverloadCandidate(S, Cand->FoundDecl, Fn, Cand->getRewriteKind(), FnDesc); Expr *FromExpr = Conv.Bad.FromExpr; @@ -10505,8 +10505,8 @@ static void DiagnoseBadTarget(Sema &S, OverloadCandidate *Cand) { std::string FnDesc; std::pair FnKindPair = - ClassifyOverloadCandidate(S, Cand->FoundDecl, Callee, Cand->RewriteKind, - FnDesc); + ClassifyOverloadCandidate(S, Cand->FoundDecl, Callee, + Cand->getRewriteKind(), FnDesc); S.Diag(Callee->getLocation(), diag::note_ovl_candidate_bad_target) << (unsigned)FnKindPair.first << (unsigned)ocs_non_template @@ -10624,8 +10624,8 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, if (Fn->isDeleted()) { std::string FnDesc; std::pair FnKindPair = - ClassifyOverloadCandidate(S, Cand->FoundDecl, Fn, Cand->RewriteKind, - FnDesc); + ClassifyOverloadCandidate(S, Cand->FoundDecl, Fn, + Cand->getRewriteKind(), FnDesc); S.Diag(Fn->getLocation(), diag::note_ovl_candidate_deleted) << (unsigned)FnKindPair.first << (unsigned)FnKindPair.second << FnDesc @@ -10635,7 +10635,7 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, } // We don't really have anything else to say about viable candidates. - S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->RewriteKind); + S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->getRewriteKind()); return; } @@ -10668,7 +10668,7 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, case ovl_fail_trivial_conversion: case ovl_fail_bad_final_conversion: case ovl_fail_final_conversion_not_exact: - return S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->RewriteKind); + return S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->getRewriteKind()); case ovl_fail_bad_conversion: { unsigned I = (Cand->IgnoreObjectArgument ? 1 : 0); @@ -10679,7 +10679,7 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand, // FIXME: this currently happens when we're called from SemaInit // when user-conversion overload fails. Figure out how to handle // those conditions and diagnose them well. - return S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->RewriteKind); + return S.NoteOverloadCandidate(Cand->FoundDecl, Fn, Cand->getRewriteKind()); } case ovl_fail_bad_target: