[PATCH] New warning when using memset etc on std class data

Richard Smith richard at metafoo.co.uk
Wed Nov 13 15:34:41 PST 2013


Testing for class members with types in namespace std seems extremely
ad-hoc and rather hacky. Can we test for a more general and defensible
property instead, like checking whether the class type has a trivial
default constructor?


On Wed, Nov 13, 2013 at 3:27 PM, Daniel Marjamäki <
Daniel.Marjamaki at evidente.se> wrote:

>
> Hello!
>
> I'd like to get comments / reviews for this patch.
>
> clang currently writes warnings if memset is used on a class that contains
> virtual methods.
>
> This patch adds warnings when memset is used on a class that contains std
> class members. This can cause weird bugs.
>
> I have seen such bugs in a closed source project. And there was also a
> major cleanup of such bugs a few years ago in boinc.
>
> Best regards,
> Daniel Marjamäki
>
>
> ..................................................................................................................
> Daniel Marjamäki
> Senior Engineer
> Evidente ES East AB
> Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
>
> Mobile:
> +46 (0)709 12 42 62
> E-mail:
>
> Daniel.Marjamaki at evidente.se
>
>
> www.evidente.se
>
>
>
>
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131113/16b89f82/attachment.html>


More information about the cfe-commits mailing list