]> granicus.if.org Git - clang/commit
Fix determination of whether a reinterpret_cast casts away constness.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 10 Jul 2018 23:04:35 +0000 (23:04 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 10 Jul 2018 23:04:35 +0000 (23:04 +0000)
commit284abf4f1cb32a5f7a3134209c5d7b83923c720d
treed5ee7bb6ec54a1811cb0006b2e1b45eef1dc4922
parent032aa95be6020f58220afb96afceaa25829236c9
Fix determination of whether a reinterpret_cast casts away constness.

The "casts away constness" check doesn't care at all how the different
layers of the source and destination type were formed: for example, if
the source is a pointer and the destination is a pointer-to-member, the
types are still decomposed and their pointee qualifications are still
checked.

This rule is bizarre and somewhat ridiculous, so as an extension we
accept code making use of such reinterpret_casts with a warning outside
of SFINAE contexts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336738 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaCast.cpp
test/CXX/expr/expr.post/expr.reinterpret.cast/p2.cpp [new file with mode: 0644]
test/Sema/warn-cast-qual.c