1 /* Test demangling an Objective-C method. */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
4 /* { dg-additional-options "-Wno-objc-root-class" } */
10 #include <objc/objc.h>
12 @interface DemangleTest
17 + (int) testFunction1;
18 + (int) test_function2;
19 + (int) __testFunction3: (int)unused andArgument: (char)unused2;
22 @implementation DemangleTest
23 + (id) initialize { return self; }
26 printf ("%s\n", __PRETTY_FUNCTION__);
27 return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest testFunction1]");
29 /* Note that in general, due to how mangling is done, it's impossible
30 to get the demangling right for all functions containing '_' in the
31 name. But at least we should be able to get that right for single
32 argument ones that don't end with '_', such as the following
34 + (int) test_function2
36 printf ("%s\n", __PRETTY_FUNCTION__);
37 return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest test_function2]");
39 + (int) __testFunction3: (int)unused andArgument: (char)unused2
41 printf ("%s\n", __PRETTY_FUNCTION__);
42 return strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
48 if ([DemangleTest testFunction1] != 0)
51 if ([DemangleTest test_function2] != 0)
54 if ([DemangleTest __testFunction3:0 andArgument: 'c'] != 0)