diff options
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 661f589099..e1d32056eb 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -4808,7 +4808,6 @@ ExprResult Sema::CheckConvertedConstantExpression(Expr *From, QualType T, // Check for a narrowing implicit conversion. APValue PreNarrowingValue; QualType PreNarrowingType; - bool Diagnosed = false; switch (SCS->getNarrowingKind(Context, Result.get(), PreNarrowingValue, PreNarrowingType)) { case NK_Variable_Narrowing: @@ -4818,16 +4817,18 @@ ExprResult Sema::CheckConvertedConstantExpression(Expr *From, QualType T, break; case NK_Constant_Narrowing: - Diag(From->getLocStart(), diag::err_cce_narrowing) + Diag(From->getLocStart(), + isSFINAEContext() ? diag::err_cce_narrowing_sfinae : + diag::err_cce_narrowing) << CCE << /*Constant*/1 << PreNarrowingValue.getAsString(Context, PreNarrowingType) << T; - Diagnosed = true; break; case NK_Type_Narrowing: - Diag(From->getLocStart(), diag::err_cce_narrowing) + Diag(From->getLocStart(), + isSFINAEContext() ? diag::err_cce_narrowing_sfinae : + diag::err_cce_narrowing) << CCE << /*Constant*/0 << From->getType() << T; - Diagnosed = true; break; } @@ -4849,10 +4850,6 @@ ExprResult Sema::CheckConvertedConstantExpression(Expr *From, QualType T, } } - // Only issue one narrowing diagnostic. - if (Diagnosed) - return Result; - // It's not a constant expression. Produce an appropriate diagnostic. if (Notes.size() == 1 && Notes[0].second.getDiagID() == diag::note_invalid_subexpr_in_const_expr) |