diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-28 22:36:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-28 22:36:06 +0000 |
commit | 10982ea3f9e11da2311b6b47d6bad2dd63bdff9d (patch) | |
tree | 9b1f73c9682d8d24f0fcdac7937dbc819ff31952 /clang/test/SemaCXX/offsetof.cpp | |
parent | 669064a772092f8588c22bf06ae669ecb3c2eb62 (diff) | |
download | bcm5719-llvm-10982ea3f9e11da2311b6b47d6bad2dd63bdff9d.tar.gz bcm5719-llvm-10982ea3f9e11da2311b6b47d6bad2dd63bdff9d.zip |
Diagnose __builtin_offsetof expressions that refer to bit-fields
llvm-svn: 102548
Diffstat (limited to 'clang/test/SemaCXX/offsetof.cpp')
-rw-r--r-- | clang/test/SemaCXX/offsetof.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/offsetof.cpp b/clang/test/SemaCXX/offsetof.cpp index a1d907ab360..4be97a948f6 100644 --- a/clang/test/SemaCXX/offsetof.cpp +++ b/clang/test/SemaCXX/offsetof.cpp @@ -28,3 +28,11 @@ void test_ice(int i) { int array0[__builtin_offsetof(HasArray, array[5])]; int array1[__builtin_offsetof(HasArray, array[i])]; // expected-error{{variable length arrays are not permitted in C++}} } + +// Bitfields +struct has_bitfields { + int i : 7; + int j : 12; // expected-note{{bit-field is declared here}} +}; + +int test3 = __builtin_offsetof(struct has_bitfields, j); // expected-error{{cannot compute offset of bit-field 'j'}} |