cgraph: A COMDAT decl always has non-zero address.
[gcc.git] / gcc / testsuite / obj-c++.dg / objc-gc-3.mm
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-skip-if "GC API is an error from Darwin16." { *-*-darwin1[6-8]* } { "-fnext-runtime" } { "" } } */
7 /* { dg-options "-fobjc-gc" } */
8 /* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
9
10 #include "../objc-obj-c++-shared/TestsuiteObject.h"
11 #include "../objc-obj-c++-shared/runtime.h"
12
13 @class MyWindow;
14
15 @interface MyDocument : TestsuiteObject {
16 MyWindow *_window;
17 }
18 @end
19
20 @interface MyFileDocument : MyDocument {
21 struct {
22 unsigned int autoClose:1;
23 unsigned int openForUI:1;
24 unsigned int isClosing:1;
25 unsigned int needsDiskCheck:1;
26 unsigned int isWritable:1;
27 unsigned int representsFileOnDisk:1;
28 unsigned int RESERVED:26;
29 } _fdFlags;
30 }
31 @end
32
33 @interface MyTextFileDocument : MyFileDocument {
34 TestsuiteObject *_textStorage;
35 struct __tfdFlags {
36 unsigned int immutable:1;
37 unsigned int lineEnding:2;
38 unsigned int isClosing:1;
39 unsigned int settingsAreSet:1;
40 unsigned int usesTabs:1;
41 unsigned int isUTF8WithBOM:1;
42 unsigned int wrapsLines:1;
43 unsigned int usingDefaultLanguage:1;
44 unsigned int RESERVED:23;
45 } _tfdFlags;
46 int _tabWidth;
47 int _indentWidth;
48 }
49 @end
50
51 @interface MyRTFFileDocument : MyTextFileDocument
52 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type;
53 @end
54
55 @implementation MyRTFFileDocument
56 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type {
57 if (_textStorage && fileName) {
58 [_textStorage free];
59 return YES;
60 } else if (type) {
61 _textStorage = [MyRTFFileDocument new];
62 return NO;
63 }
64 return (fileName && type);
65 }
66 @end