https://bugs.llvm.org/show_bug.cgi?id=37979
Bug ID: 37979
Summary: incorrect sizeof for bitfield enum values
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: s...@chromium.org
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Looks like this was broken by https://reviews.llvm.org/rL335781
The following test case is derived from one of the GCC torture tests:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/g%2B%2B.dg/conversion/bitfield1.C
$ cat test.cc
enum E { a, b = 1LL << 48 };
struct S {
E e : 3;
};
S s;
int main () {
static_assert(sizeof(E) == sizeof(long long));
static_assert(sizeof(s.e + 3) == sizeof(long long));
}
$ ./bin/clang++ --std=c++17 -c test.cc
test.cc:11:3: error: static_assert failed
static_assert(sizeof(s.e + 3) == sizeof(long long));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs