81dc6eea5e
In gcc/testsuite/: 2011-01-12 Nicola Pero <nicola.pero@meta-innovation.com> Fixed the Objective-C++ testsuite and updated all tests. * lib/obj-c++.exp (obj-c++_init): Declare and set gcc_warning_prefix and gcc_error_prefix. * obj-c++.dg/attributes/categ-attribute-2.mm: Fixed usage of 'dg-warning', 'dg-message' and 'dg-error'. * obj-c++.dg/class-extension-3.mm: Likewise. * obj-c++.dg/class-protocol-1.mm: Likewise. * obj-c++.dg/cxx-scope-2.mm: Likewise. * obj-c++.dg/encode-7.mm: Likewise. * obj-c++.dg/exceptions-3.mm: Likewise. * obj-c++.dg/exceptions-5.mm: Likewise. * obj-c++.dg/method-12.mm: Likewise. * obj-c++.dg/method-13.mm: Likewise. * obj-c++.dg/method-15.mm: Likewise. * obj-c++.dg/method-16.mm: Likewise. * obj-c++.dg/method-4.mm: Likewise. * obj-c++.dg/method-8.mm: Likewise. * obj-c++.dg/method-conflict-1.mm: Likewise. * obj-c++.dg/method-conflict-2.mm: Likewise. * obj-c++.dg/method-conflict-3.mm: Likewise. Also, removed FIXME and uncommented second part of the testcase now that the testsuite works correctly. * obj-c++.dg/method-conflict-4.mm: Likewise. Also, removed FIXME and uncommented second part of the testcase now that the testsuite works correctly. * obj-c++.dg/private-1.mm: Likewise. * obj-c++.dg/proto-lossage-4.mm: Likewise. * obj-c++.dg/syntax-error-7.mm: Likewise. * obj-c++.dg/warn5.mm: Likewise. * obj-c++.dg/property/at-property-14.mm: Likewise. * obj-c++.dg/property/at-property-16.mm: Likewise, and removed FIXME. * obj-c++.dg/property/at-property-18.mm: Likewise. * obj-c++.dg/property/at-property-20.mm: Likewise, and removed FIXME. * obj-c++.dg/property/at-property-21.mm: Likewise. * obj-c++.dg/property/at-property-28.mm: Likewise. * obj-c++.dg/property/at-property-5.mm: Likewise. * obj-c++.dg/property/dynamic-2.mm: Likewise. * obj-c++.dg/property/property-neg-3.mm: Likewise. * obj-c++.dg/property/synthesize-11.mm: Likewise. * obj-c++.dg/property/synthesize-6.mm: Likewise. * obj-c++.dg/property/synthesize-8.mm: Likewise. * obj-c++.dg/property/synthesize-9.mm: Likewise. * obj-c++.dg/tls/diag-5.mm: Likewise. * obj-c++.dg/ivar-invalid-type-1.mm: Removed FIXME and uncommented dg-error, now matched correctly. From-SVN: r168699
35 lines
1.2 KiB
Plaintext
35 lines
1.2 KiB
Plaintext
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010. */
|
|
/* { dg-do compile } */
|
|
|
|
#include <objc/objc.h>
|
|
|
|
/* Test that you can not declare two methods, in the same protocol,
|
|
with the same name and method signature, but one as @required and
|
|
once as @optional. */
|
|
|
|
/* First, @required conflicting with @optional. */
|
|
@protocol MyProtocol
|
|
|
|
@optional
|
|
+ (void) method1: (id)x; /* { dg-message "previous declaration" } */
|
|
- (id) method2: (long)x; /* { dg-message "previous declaration" } */
|
|
|
|
@required
|
|
+ (void) method1: (id)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
|
|
- (id) method2: (long)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
|
|
|
|
@end
|
|
|
|
/* Second, @optional conflicting with @required. */
|
|
@protocol MyProtocol2
|
|
|
|
@required
|
|
+ (void) method3: (Class)x; /* { dg-message "previous declaration" } */
|
|
- (id *) method4: (long)x; /* { dg-message "previous declaration" } */
|
|
|
|
@optional
|
|
+ (void) method3: (Class)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
|
|
- (id *) method4: (long)x; /* { dg-error "declared .@optional. and .@required. at the same time" } */
|
|
|
|
@end
|