[PATCH] D16738: Fix invalid casts in <functional>.

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 29 14:57:46 PST 2016


eugenis created this revision.
eugenis added reviewers: EricWF, mclow.lists.
eugenis added subscribers: cfe-commits, pcc.
eugenis set the repository for this revision to rL LLVM.

static_cast of a pointer to object before the start of the object's
lifetime has undefined behavior (c++14 p3.8)

This code triggers CFI warnings.

This also could be fixed in a different way by replacing C-style
casts with reinterpret_cast<>, which, from my reading of the
standard, is allowed in this context. That would not help with CFI
though, which still flags such casts as invalid (yes, it is stricter
that the standard).

Repository:
  rL LLVM

http://reviews.llvm.org/D16738

Files:
  include/functional

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16738.46437.patch
Type: text/x-patch
Size: 5406 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160129/0480920b/attachment-0001.bin>


More information about the cfe-commits mailing list