mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Add a test case for PR1420
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37082 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ce3e2bff8b
commit
8ff18f162b
35
test/C++Frontend/2007-05-15-FieldAccess.cpp
Normal file
35
test/C++Frontend/2007-05-15-FieldAccess.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Test case for PR1420
|
||||
// RUN: %llvmgxx %s -O0 -o %t.exe
|
||||
// RUN: %t.exe > %t.out
|
||||
// RUN: grep {sizeof(bitFieldStruct) == 8} %t.out
|
||||
// RUN: grep {Offset bitFieldStruct.i = 0} %t.out
|
||||
// RUN: grep {Offset bitFieldStruct.c2 = 7} %t.out
|
||||
// XFAIL: *
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class bitFieldStruct {
|
||||
public:
|
||||
int i;
|
||||
unsigned char c:7;
|
||||
int s:17;
|
||||
char c2;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("sizeof(bitFieldStruct) == %d\n", sizeof(bitFieldStruct));
|
||||
|
||||
if (sizeof(bitFieldStruct) != 2 * sizeof(int))
|
||||
printf("bitFieldStruct should be %d but is %d \n",
|
||||
2 * sizeof(int), sizeof(bitFieldStruct));
|
||||
|
||||
bitFieldStruct x;
|
||||
|
||||
char* xip = (char*) &x.i;
|
||||
char* xc2p = (char*) &x.c2;
|
||||
printf("Offset bitFieldStruct.i = %d\n", xip - xip);
|
||||
printf("Offset bitFieldStruct.c2 = %d\n", xc2p - xip);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user