[libcxx] r185265 - Add operators to make launch a bitmask type. Searched all of the standard, and libc++ to see if this error occurred elsewhere and didn't see any other place. This fixes http://llvm.org/bugs/show_bug.cgi?id=16207
mclow.lists at gmail.com
Mon Jul 1 06:15:46 PDT 2013
On Jun 29, 2013, at 11:38 AM, Howard Hinnant <hhinnant at apple.com> wrote:
> +inline _LIBCPP_INLINE_VISIBILITY
> +operator~(launch __x)
> + return static_cast<launch>(~static_cast<__launch_underlying_type>(__x));
This may cause problems down the line, because it sets bits in launch that are not defined to have any meaning.
I ran into this kind of stuff when trying to use UBSan.
To prevent this problem, you can AND the result with 3, clearing all the unused bits.
> + return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
(Yeah, I hate the naked '3' there too.)
Marshall Clow Idio Software <mailto:mclow.lists at gmail.com>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
More information about the cfe-commits