diff options
| author | 2018-04-06 14:26:03 +0000 | |
|---|---|---|
| committer | 2018-04-06 14:26:03 +0000 | |
| commit | bdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch) | |
| tree | c50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp | |
| parent | Print a 'p' flag for file descriptors that were opened after pledge(2). (diff) | |
| download | wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip | |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp b/gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp index d603101c3fd..ad6348685b6 100644 --- a/gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp +++ b/gnu/llvm/tools/clang/lib/Sema/SemaCast.cpp @@ -2458,24 +2458,17 @@ void CastOperation::CheckCStyleCast() { // GCC's cast to union extension. if (DestRecordTy && DestRecordTy->getDecl()->isUnion()) { RecordDecl *RD = DestRecordTy->getDecl(); - RecordDecl::field_iterator Field, FieldEnd; - for (Field = RD->field_begin(), FieldEnd = RD->field_end(); - Field != FieldEnd; ++Field) { - if (Self.Context.hasSameUnqualifiedType(Field->getType(), SrcType) && - !Field->isUnnamedBitfield()) { - Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) - << SrcExpr.get()->getSourceRange(); - break; - } - } - if (Field == FieldEnd) { + if (CastExpr::getTargetFieldForToUnionCast(RD, SrcType)) { + Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union) + << SrcExpr.get()->getSourceRange(); + Kind = CK_ToUnion; + return; + } else { Self.Diag(OpRange.getBegin(), diag::err_typecheck_cast_to_union_no_type) << SrcType << SrcExpr.get()->getSourceRange(); SrcExpr = ExprError(); return; } - Kind = CK_ToUnion; - return; } // OpenCL v2.0 s6.13.10 - Allow casts from '0' to event_t type. |
