[PATCH] D24289: Add warning when assigning enums to bitfields without an explicit unsigned underlying type
Sasha Bermeister via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 15 22:31:48 PDT 2016
sashab added a comment.
Thanks all! :)
================
Comment at: test/SemaCXX/warn-msvc-enum-bitfield.cpp:12
@@ +11,3 @@
+
+ s.e2 = E2;
+ s.f2 = F2;
----------------
thakis wrote:
> Shouldn't this be the version that warns? The assignment with E1 assigns 0 which is portable, but this assigns 1 which overflows, right?
e2 is not a bitfield :) So this code is fine.
And we should warn on all assignments, since any assigned value could potentially be incorrect. Also, most assignments are not static so we don't always have that information :)
https://reviews.llvm.org/D24289
More information about the cfe-commits
mailing list