| 1 |
/* Ensure that overload resolution does not produce warnings as |
| 2 |
side-effects. */ |
| 3 |
/* { dg-do run } */ |
| 4 |
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ |
| 5 |
|
| 6 |
#include "../objc-obj-c++-shared/TestsuiteObject.m" |
| 7 |
#include <stdlib.h> |
| 8 |
|
| 9 |
#define CHECK_IF(E) if(!(E)) abort () |
| 10 |
|
| 11 |
@interface MyCursor: TestsuiteObject |
| 12 |
+ (MyCursor *)crosshairCursor; |
| 13 |
@end |
| 14 |
|
| 15 |
@class MyImage; |
| 16 |
|
| 17 |
class A { |
| 18 |
public: |
| 19 |
A(); |
| 20 |
|
| 21 |
int foo(MyImage *); |
| 22 |
int foo(MyCursor *); |
| 23 |
}; |
| 24 |
|
| 25 |
A::A() {} |
| 26 |
int A::foo(MyCursor * c) { return 17; } |
| 27 |
int A::foo(MyImage * i) { return 29; } |
| 28 |
|
| 29 |
@implementation MyCursor |
| 30 |
+ (MyCursor *)crosshairCursor { |
| 31 |
return self; |
| 32 |
} |
| 33 |
@end |
| 34 |
|
| 35 |
int main(void) { |
| 36 |
A a; |
| 37 |
|
| 38 |
int r = a.foo([MyCursor crosshairCursor]); |
| 39 |
|
| 40 |
CHECK_IF (r == 17); |
| 41 |
return 0; |
| 42 |
} |
| 43 |
|