| 1 |
/* Test demangling a C++ function. */ |
| 2 |
/* { dg-do run } */ |
| 3 |
|
| 4 |
#include <cstring> |
| 5 |
#include <cstdlib> |
| 6 |
#include <iostream> |
| 7 |
|
| 8 |
class demangle_test |
| 9 |
{ |
| 10 |
public: |
| 11 |
/* Return 0 if the demangling test succeeds. */ |
| 12 |
static int test_function1 () |
| 13 |
{ |
| 14 |
std::cout << __PRETTY_FUNCTION__ << "\n"; |
| 15 |
return std::strcmp (__PRETTY_FUNCTION__, "static int demangle_test::test_function1()"); |
| 16 |
} |
| 17 |
|
| 18 |
/* Return 0 if the demangling test succeeds. */ |
| 19 |
static int test_function2 (int ignored) |
| 20 |
{ |
| 21 |
std::cout << __PRETTY_FUNCTION__ << "\n"; |
| 22 |
return std::strcmp (__PRETTY_FUNCTION__, "static int demangle_test::test_function2(int)"); |
| 23 |
} |
| 24 |
}; |
| 25 |
|
| 26 |
int main () |
| 27 |
{ |
| 28 |
if (demangle_test::test_function1 () != 0) |
| 29 |
abort (); |
| 30 |
|
| 31 |
if (demangle_test::test_function2 (0) != 0) |
| 32 |
abort (); |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |