<div dir="ltr">Alternatively could make the bool ctor a template with some SFINAE to restrict it to only parameters of type bool - thus blocking all conversions there, if they're particularly problematic.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 4, 2017 at 5:32 PM George Burgess IV via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: gbiv<br class="gmail_msg">
Date: Wed Jan 4 19:21:21 2017<br class="gmail_msg">
New Revision: 291058<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=291058&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=291058&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[Sema] Mark undefined ctors as deleted. NFC.<br class="gmail_msg">
<br class="gmail_msg">
Looks like these functions exist just to prevent bad implicit<br class="gmail_msg">
conversions. Rather than waiting for the linker to complain about<br class="gmail_msg">
undefined references to them, we can mark them as deleted.<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
cfe/trunk/include/clang/Sema/Ownership.h<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/include/clang/Sema/Ownership.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Ownership.h?rev=291058&r1=291057&r2=291058&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Ownership.h?rev=291058&r1=291057&r2=291058&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/include/clang/Sema/Ownership.h (original)<br class="gmail_msg">
+++ cfe/trunk/include/clang/Sema/Ownership.h Wed Jan 4 19:21:21 2017<br class="gmail_msg">
@@ -153,8 +153,8 @@ namespace clang {<br class="gmail_msg">
ActionResult(const DiagnosticBuilder &) : Val(PtrTy()), Invalid(true) {}<br class="gmail_msg">
<br class="gmail_msg">
// These two overloads prevent void* -> bool conversions.<br class="gmail_msg">
- ActionResult(const void *);<br class="gmail_msg">
- ActionResult(volatile void *);<br class="gmail_msg">
+ ActionResult(const void *) = delete;<br class="gmail_msg">
+ ActionResult(volatile void *) = delete;<br class="gmail_msg">
<br class="gmail_msg">
bool isInvalid() const { return Invalid; }<br class="gmail_msg">
bool isUsable() const { return !Invalid && Val; }<br class="gmail_msg">
@@ -192,8 +192,8 @@ namespace clang {<br class="gmail_msg">
ActionResult(const DiagnosticBuilder &) : PtrWithInvalid(0x01) { }<br class="gmail_msg">
<br class="gmail_msg">
// These two overloads prevent void* -> bool conversions.<br class="gmail_msg">
- ActionResult(const void *);<br class="gmail_msg">
- ActionResult(volatile void *);<br class="gmail_msg">
+ ActionResult(const void *) = delete;<br class="gmail_msg">
+ ActionResult(volatile void *) = delete;<br class="gmail_msg">
<br class="gmail_msg">
bool isInvalid() const { return PtrWithInvalid & 0x01; }<br class="gmail_msg">
bool isUsable() const { return PtrWithInvalid > 0x01; }<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-commits mailing list<br class="gmail_msg">
<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="gmail_msg">
</blockquote></div>