summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/demangle-1.mm
blob: 015a3aff848154c64f5ec0fc1fa4c98cc7806f3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Test demangling a C++ function.  */
/* { dg-do run } */

#include <cstring>
#include <cstdlib>
#include <iostream>

class demangle_test
{
public:
  /* Return 0 if the demangling test succeeds.  */
  static int test_function1 ()
  {
    std::cout << __PRETTY_FUNCTION__ << "\n";
    return std::strcmp (__PRETTY_FUNCTION__, "static int demangle_test::test_function1()");
  }

  /* Return 0 if the demangling test succeeds.  */
  static int test_function2 (int ignored)
  {
    std::cout << __PRETTY_FUNCTION__ << "\n";
    return std::strcmp (__PRETTY_FUNCTION__, "static int demangle_test::test_function2(int)");
  }
};

int main ()
{
  if (demangle_test::test_function1 () != 0)
    abort ();

  if (demangle_test::test_function2 (0) != 0)
    abort ();
  
  return 0;
}