diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-12 19:10:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-12 19:10:03 +0000 |
commit | ff07af12df83c0112d702f61557bf9541584074f (patch) | |
tree | eacee5a4e6f634e0d9f896f4c1cf2efc84a82303 /clang/lib/AST/ExprConstant.cpp | |
parent | fc5dd29ef73cd0cc1e99d906da13347c247aa260 (diff) | |
download | bcm5719-llvm-ff07af12df83c0112d702f61557bf9541584074f.tar.gz bcm5719-llvm-ff07af12df83c0112d702f61557bf9541584074f.zip |
Clean up diagnostic wording for disallowed casts in C++11 constant expressions.
llvm-svn: 146395
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 62d70dd9782..3a897ab3484 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2226,8 +2226,13 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr* E) { // Bitcasts to cv void* are static_casts, not reinterpret_casts, so are // permitted in constant expressions in C++11. Bitcasts from cv void* are // also static_casts, but we disallow them as a resolution to DR1312. - if (!E->getType()->isVoidPointerType()) - CCEDiag(E, diag::note_constexpr_invalid_cast) << 2; + if (!E->getType()->isVoidPointerType()) { + if (SubExpr->getType()->isVoidPointerType()) + CCEDiag(E, diag::note_constexpr_invalid_cast) + << 3 << SubExpr->getType(); + else + CCEDiag(E, diag::note_constexpr_invalid_cast) << 2; + } if (!Visit(SubExpr)) return false; Result.Designator.setInvalid(); |