summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/bitfield-4.m
blob: 0f78e0b1f650db00e07bb36d5e61c57ec540ecd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Make sure that bitfield types are printed correctly, and that ivar redeclaration
  (@interface vs. @implementation) checks take the bitfield width into account.  */
/* Author: Ziemowit Laski   <zlaski@apple.com>  */
/* { dg-do compile } */

@interface Base {
  int i;
}
@end

@interface WithBitfields: Base {
  void *isa;     /* { dg-line WithBitFields_isa } */
  unsigned a: 3; /* { dg-line WithBitFields_a } */
  signed b: 4;
  int c: 5;      /* { dg-line WithBitFields_c } */
}
@end

@implementation WithBitfields {
  char *isa;  /* { dg-error "conflicting instance variable type .char \\*isa." } */
  /* { dg-error "previous declaration of .void \\*isa." "" { target *-*-* } WithBitFields_isa } */
  unsigned a: 5;  /* { dg-error "conflicting instance variable type .unsigned( int)? a: 5." } */
  /* { dg-error "previous declaration of .unsigned( int)? a: 3." "" { target *-*-* } WithBitFields_a } */
  signed b: 4;  /* This one is fine. */
  int c: 3;  /* { dg-error "conflicting instance variable type .int c: 3." } */
  /* { dg-error "previous declaration of .int c: 5." "" { target *-*-* } WithBitFields_c } */ 
}
@end