OSDN Git Service

* gcc.dg/tm/memopt-6.c: Cleanup tmedge tree dump.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / pretty1.C
1 // { dg-do run }
2
3 // Copyright (C) 2002 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 14 Sep 2002 <nathan@codesourcery.com>
5
6 // PR 7768 template dtor pretty function wrong
7
8 #include <string.h>
9
10 static size_t current = 0;
11 static bool error = false;
12
13 static char const *names[] =
14 {
15   "X<T>::X() [with T = void]",
16   "X<T>::~X() [with T = void]",
17   0
18 };
19
20 void Verify (char const *ptr)
21 {
22   error = strcmp (ptr, names[current++]);
23 }
24   
25 template <typename T>
26 struct X
27 {
28   X() { Verify (__PRETTY_FUNCTION__); }
29   ~X() { Verify (__PRETTY_FUNCTION__); }
30 };
31
32 int main()
33 {
34   {
35     X<void> x;
36     
37     if (error)
38       return current;
39   }
40   if (error)
41     return current;
42   return 0;
43 }