1/* Test looking up fields in superclasses in the context of write-barriers
2   (where component references get rewritten).  */
3/* Contributed by Ziemowit Laski <zlaski@apple.com>  */
4
5/* { dg-do compile } */
6/* { dg-options "-fobjc-gc" } */
7/* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
8
9#include "../objc-obj-c++-shared/TestsuiteObject.h"
10#include "../objc-obj-c++-shared/runtime.h"
11
12@class MyWindow;
13
14@interface MyDocument : TestsuiteObject {
15    MyWindow *_window;
16}
17@end
18
19@interface MyFileDocument : MyDocument {
20     struct {
21        unsigned int autoClose:1;
22        unsigned int openForUI:1;
23        unsigned int isClosing:1;
24        unsigned int needsDiskCheck:1;
25        unsigned int isWritable:1;
26        unsigned int representsFileOnDisk:1;
27        unsigned int RESERVED:26;
28    } _fdFlags;
29}
30@end
31
32@interface MyTextFileDocument : MyFileDocument {
33    TestsuiteObject *_textStorage;
34    struct __tfdFlags {
35        unsigned int immutable:1;
36        unsigned int lineEnding:2;
37        unsigned int isClosing:1;
38        unsigned int settingsAreSet:1;
39        unsigned int usesTabs:1;
40        unsigned int isUTF8WithBOM:1;
41        unsigned int wrapsLines:1;
42        unsigned int usingDefaultLanguage:1;
43        unsigned int RESERVED:23;
44    } _tfdFlags;
45    int _tabWidth;
46    int _indentWidth;
47}
48@end
49
50@interface MyRTFFileDocument : MyTextFileDocument
51- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type;
52@end
53
54@implementation MyRTFFileDocument
55- (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type {
56        if (_textStorage && fileName) {
57            [_textStorage free];
58	    return YES;
59        } else if (type) {
60            _textStorage = [MyRTFFileDocument new];
61	    return NO;
62        }
63   return (fileName && type);
64}
65@end
66