<br><br><div class="gmail_quote">Le 29 janvier 2012 09:30, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">FWIW, I've not checked to see whether it could just be replaced with abort, or no body at all. I'll look into it when I can. However...</div><div class="gmail_quote"><br></div><div class="gmail_quote">
<div class="im">
On Sat, Jan 28, 2012 at 10:38 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>You mean like<br>
<div><br>
template <typename T><br>
inline T Invalid() {<br>
</div> return *static_cast<volatile typename remove_reference<T>::type*>(0);<br></div></blockquote><div><br></div></div><div>The error below can be addressed quite simply:</div><div><br></div><div>return *const_cast<typename remove_reference<T>::type&>(static_cast<volatile typename remove_reference<T>::type*>(0));</div>
<div><br></div><div>You might think that this could just be 'const_cast<T&>(...)' but while this is equivalent according to the standard thanks to reference collapsing, we found that some compilers choked on it spectacularly. =/ I can't remember whether it was an older MSVC, or the GCC in an older version of xcode.</div>
</div>
<br><br></blockquote><div><br>// the reference looks wrong<br>return *const_cast<typename remove_reference<T>::type&>(static_cast<volatile typename remove_reference<T>::type*>(0));<br><br>// this looks better<br>
return *const_cast<typename remove_reference<T>::type*>(static_cast<volatile typename remove_reference<T>::type*>(0)); <br></div></div><br>-- Matthieu<br>