зеркало из https://github.com/microsoft/clang.git
On second thought, don't warn about reinterpret_casts under -Wcast-align.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111497 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c9f8aece7e
Коммит
35a38d95da
|
@ -468,8 +468,6 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
|
|||
!= TC_Success && msg != 0)
|
||||
Self.Diag(OpRange.getBegin(), msg) << CT_Reinterpret
|
||||
<< SrcExpr->getType() << DestType << OpRange;
|
||||
else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
|
||||
Self.CheckCastAlign(SrcExpr, DestType, OpRange);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ void test0(char *P) {
|
|||
a = CharPtr(P);
|
||||
|
||||
b = (short*) P; // expected-warning {{cast from 'char *' to 'short *' increases required alignment from 1 to 2}}
|
||||
b = reinterpret_cast<short*>(P); // expected-warning {{cast from 'char *' to 'short *' increases required alignment from 1 to 2}}
|
||||
b = reinterpret_cast<short*>(P);
|
||||
typedef short *ShortPtr;
|
||||
b = ShortPtr(P); // expected-warning {{cast from 'char *' to 'ShortPtr' (aka 'short *') increases required alignment from 1 to 2}}
|
||||
|
||||
c = (int*) P; // expected-warning {{cast from 'char *' to 'int *' increases required alignment from 1 to 4}}
|
||||
c = reinterpret_cast<int*>(P); // expected-warning {{cast from 'char *' to 'int *' increases required alignment from 1 to 4}}
|
||||
c = reinterpret_cast<int*>(P);
|
||||
typedef int *IntPtr;
|
||||
c = IntPtr(P); // expected-warning {{cast from 'char *' to 'IntPtr' (aka 'int *') increases required alignment from 1 to 4}}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче