diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-15 03:51:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-01-15 03:51:30 +0000 |
commit | 244ee7b89a483fd3764637abdf95de2893b437d0 (patch) | |
tree | b9a100ef2aedd776604c0199e746cbb73718971c /lib/Sema/SemaExpr.cpp | |
parent | 28c1ce789322ab99f9b5887015d63ec5f088957a (diff) |
Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 75caa6f585..e2a9404d21 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -9268,9 +9268,11 @@ bool Sema::VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result, } if (!Folded || !AllowFold) { - Diag(E->getSourceRange().getBegin(), - DiagID ? DiagID : unsigned(diag::err_expr_not_ice)) - << E->getSourceRange(); + if (DiagID) + Diag(E->getSourceRange().getBegin(), DiagID) << E->getSourceRange(); + else + Diag(E->getSourceRange().getBegin(), diag::err_expr_not_ice) + << E->getSourceRange() << LangOpts.CPlusPlus; // We only show the notes if they're not the usual "invalid subexpression" // or if they are actually in a subexpression. @@ -9285,12 +9287,9 @@ bool Sema::VerifyIntegerConstantExpression(const Expr *E, llvm::APSInt *Result, } Diag(E->getSourceRange().getBegin(), diag::ext_expr_not_ice) - << E->getSourceRange(); - - if (Diags.getDiagnosticLevel(diag::ext_expr_not_ice, E->getExprLoc()) - != DiagnosticsEngine::Ignored) - for (unsigned I = 0, N = Notes.size(); I != N; ++I) - Diag(Notes[I].first, Notes[I].second); + << E->getSourceRange() << LangOpts.CPlusPlus; + for (unsigned I = 0, N = Notes.size(); I != N; ++I) + Diag(Notes[I].first, Notes[I].second); if (Result) *Result = EvalResult.Val.getInt(); |