| 1 |
/* Contributed by Nicola Pero <[email protected]>, May 2011. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ |
| 4 |
|
| 5 |
#include <objc/runtime.h> |
| 6 |
#include <stdlib.h> |
| 7 |
|
| 8 |
int main(int argc, void **args) |
| 9 |
{ |
| 10 |
#ifdef __GNU_LIBOBJC__ |
| 11 |
/* This special test tests that, if you have a selector already |
| 12 |
registered in the runtime with full type information, you can use |
| 13 |
sel_registerTypedName() to get it even if you specify the type |
| 14 |
with incorrect argframe information. This is helpful as |
| 15 |
selectors generated by the compiler (which have correct argframe |
| 16 |
information) are usually registered before hand-written ones |
| 17 |
(which often have incorrect argframe information, but need the |
| 18 |
correct one). |
| 19 |
|
| 20 |
Note that in this hand-written test, even the type information of |
| 21 |
the first selector may be wrong (on this machine); but that's OK |
| 22 |
as we'll never actually use the selectors. */ |
| 23 |
SEL selector1 = sel_registerTypedName ("testMethod", "i8@0:4"); |
| 24 |
SEL selector2 = sel_registerTypedName ("testMethod", "i8@8:8"); |
| 25 |
|
| 26 |
/* We compare the selectors using ==, not using sel_isEqual(). This |
| 27 |
is because we are testing internals of the runtime and we know |
| 28 |
that in the current implementation they should be identical if |
| 29 |
the stuff is to work as expected. Don't do this at home. */ |
| 30 |
if (selector1 != selector2) |
| 31 |
abort (); |
| 32 |
#endif |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |