libstdc++: Define __glibcxx_assert_fail for non-verbose build [PR115585]
[official-gcc.git] / gcc / testsuite / obj-c++.dg / proto-lossage-1.mm
blob82cd05374b2e64d941074dca0bde7c846f22d844
1 /* Test for situations in which protocol conformance information
2    may be lost, leading to superfluous warnings.  */
3 /* Author: Ziemowit Laski <zlaski@apple.com>.  */
4 /* { dg-do compile } */
5 // { dg-additional-options "-Wno-objc-root-class" }
7 /* One-line substitute for objc/objc.h */
8 typedef struct objc_object { struct objc_class *class_pointer; } *id;
10 @protocol NSObject
11 - (int)someValue;
12 @end
14 @interface NSObject <NSObject>
15 @end
17 @protocol PlateMethods
18 - (void)someMethod;
19 @end
21 @interface Foo {
22   NSObject <PlateMethods> *plate;
23   id <PlateMethods> plate1;
24   NSObject *plate2;
26 - (id <PlateMethods>) getPlate;
27 - (id <NSObject>) getPlate1;
28 - (int) getValue;
29 @end
31 @implementation Foo
32 - (id <PlateMethods>) getPlate {
33   return plate;  /* { dg-bogus "does not implement" } */
35 - (id <NSObject>) getPlate1 {
36   return (id <NSObject>)plate1; /* { dg-bogus "does not conform" } */
38 - (int) getValue {
39   int i = [plate1 someValue];   /* { dg-warning ".\\-someValue. not found in protocol\\(s\\)" } */
41   int j = [(id <NSObject>)plate1 someValue];  /* { dg-bogus "not found in protocol" } */
42   int k = [(id)plate1 someValue]; /* { dg-bogus "not found in protocol" } */
43   return i + j + k;
45 @end