[PATCH] D23831: Fix gcc 4.9 -Wcast-qual warning.
Andrey Khalyavin via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 24 04:40:39 PDT 2016
halyavin created this revision.
halyavin added reviewers: cfe-commits, EricWF, mclow.lists.
C-style cast from const pointer to non-const pointer causes -Wcast-qual warning in gcc. Fix the problem by casting away const with const_cast. Additionally, replace C-style cast with appropriate C++-style cast.
https://reviews.llvm.org/D23831
Files:
include/type_traits
Index: include/type_traits
===================================================================
--- include/type_traits
+++ include/type_traits
@@ -443,7 +443,7 @@
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
- return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
+ return reinterpret_cast<_Tp*>(const_cast<char*>(&reinterpret_cast<const volatile char&>(__x)));
}
#endif // __has_builtin(__builtin_addressof)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23831.69096.patch
Type: text/x-patch
Size: 419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160824/ca4edbf9/attachment.bin>
More information about the cfe-commits
mailing list