Le 29 janvier 2012 09:30, Chandler Carruth <[email protected]> a écrit :
> 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... > > On Sat, Jan 28, 2012 at 10:38 PM, Nico Weber <[email protected]> wrote: > >> You mean like >> >> template <typename T> >> inline T Invalid() { >> return *static_cast<volatile typename remove_reference<T>::type*>(0); >> > > The error below can be addressed quite simply: > > return *const_cast<typename > remove_reference<T>::type&>(static_cast<volatile typename > remove_reference<T>::type*>(0)); > > 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. > > > // the reference looks wrong return *const_cast<typename remove_reference<T>::type&>(static_cast<volatile typename remove_reference<T>::type*>(0)); // this looks better return *const_cast<typename remove_reference<T>::type*>(static_cast<volatile typename remove_reference<T>::type*>(0)); -- Matthieu
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
