[PATCH] D30923: Warn on enum assignment to bitfields that can't fit all values
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 08:44:29 PDT 2017
thakis accepted this revision.
thakis added a comment.
This revision is now accepted and ready to land.
Looks like a cool warning. Two suggestions for more exhaustive testing, but I think this looks good.
Comment at: test/SemaCXX/warn-bitfield-enum-conversion.cpp:1
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-msvc -verify %s -Wbitfield-enum-conversion
Consider also running this test with a triple where enums don't default to signed.
Comment at: test/SemaCXX/warn-bitfield-enum-conversion.cpp:15
+ ThreeBits three_bits_enum : 3;
Also add a : 4 version and check that that doesn't warn?
More information about the cfe-commits