[cfe-commits] r148874 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/Analysis/reference.cpp

Chandler Carruth chandlerc at google.com
Sun Jan 29 00:30:33 PST 2012


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 <thakis at chromium.org> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120129/a35acd8e/attachment.html>


More information about the cfe-commits mailing list