[PATCH] D31022: Implement P0298R3: `std::byte`
James Y Knight via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 3 07:53:53 PDT 2017
jyknight added a comment.
I believe this needs compiler support, too, in order to treat
namespace std { enum class byte : unsigned char {}; }
as directly having tbaa type "omnipotent char" instead of a subtype.
That is, given:
void foo(char* x, int *y) {
x[1] = char(y[0] & 0xff);
x[0] = char((y[0] & 0xff00) >> 8);
}
the compiler assumes that x and y might alias each-other, and thus must have two loads of y[0]. If you replace "char" with "std::byte", the same should happen, but as of now does not.
https://reviews.llvm.org/D31022
More information about the cfe-commits
mailing list