<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 26, 2016 at 10:29 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Essentially this code was trying to check "is it safe to reinterpret_cast sizeof(T) bytes to a T*".<div><br></div><div>Is there a better way to check that?</div></div></blockquote><div><br></div><div>Nope, not that I can think of. (& presumably you want to check alignment too)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Thu, May 26, 2016 at 10:00 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 26, 2016 at 7:53 PM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ruiu added inline comments.<br>
<span><br>
================<br>
Comment at: include/llvm/DebugInfo/CodeView/StreamArray.h:114-115<br>
@@ -113,4 +113,2 @@<br>
</span><span>   friend class FixedStreamArrayIterator<T>;<br>
-  static_assert(std::is_trivially_constructible<T>::value,<br>
-                "FixedStreamArray must be used with trivial types");<br>
<br>
</span>----------------<br>
<span>majnemer wrote:<br>
> You could go with `std::is_standard_layout<T>::value && std::is_trivial<T>::value` to get more or less the same thing.<br>
</span>This seems a bit too tricky to me. It would just fail if you pass non-trivially-constructible class to this one, so I'm okay without this assertion.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>what/how would it fail? Testing for is_trivially_constructible to me would indicate that this code is using memory that's perhaps zero'd out without invoking the ctor for the type. If the type isn't trivially constructible that sort of thing's going to result in subtle behavior, quite often not an outright failure.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div><br>
<br>
<a href="http://reviews.llvm.org/D20719" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20719</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>
</blockquote></div>
</div></div></blockquote></div><br></div></div>