PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / obj-c++.dg / demangle-2.mm
blobf28208591372a443f155e09f40ffff15498c4871
1 /* Test demangling an Objective-C method.  */
2 /* { dg-do run } */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 #include <cstring>
6 #include <cstdlib>
7 #include <iostream>
8 #include <objc/objc.h>
10 @interface DemangleTest
12   Class isa;
14 + (int) testFunction1;
15 + (int) test_function2;
16 + (int) __testFunction3: (int)unused  andArgument: (char)unused2;
17 + (id) initialize;
18 @end
20 @implementation DemangleTest
21 + (int) testFunction1
23   std::cout << __PRETTY_FUNCTION__ << "\n";
24   return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest testFunction1]");
26 + (int) test_function2
28   std::cout << __PRETTY_FUNCTION__ << "\n";
29   return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest test_function2]");
31 + (int) __testFunction3: (int)unused   andArgument: (char)unused2
33   std::cout << __PRETTY_FUNCTION__ << "\n";
34   return std::strcmp (__PRETTY_FUNCTION__, "+[DemangleTest __testFunction3:andArgument:]");
36 + (id) initialize { return self; }
37 @end
39 int main ()
41   if ([DemangleTest testFunction1] != 0)
42       abort ();
44   if ([DemangleTest test_function2] != 0)
45       abort ();
47   if ([DemangleTest __testFunction3:0 andArgument: 'c'] != 0)
48       abort ();
49   
50   return 0;