Regenerate common.opt.urls
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.ext / pretty3.C
blob6348ae1ee67449e575787060aba80dd16486e23a
1 // { dg-do run  }
2 // Copyright (C) 1999 Free Software Foundation, Inc.
3 // Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
5 // make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates
7 #include <stdio.h>
8 #include <string.h>
10 static bool bad = false;
12 template<class T> void f1 (T)
14   char const *function = __FUNCTION__;
15   char const *pretty = __PRETTY_FUNCTION__;
16   
17   printf ("generic\n");
18   printf ("__FUNCTION__ %s\n", function);
19   printf ("__PRETTY_FUNCTION__ %s\n", pretty);
20   
21   if (strcmp (function, "f1"))
22     bad = true;
23   if (strcmp (pretty, "void f1(T) [with T = float]")) // only for float instantiation
24     bad = true;
27 template<> void f1<int> (int)
29   char const *function = __FUNCTION__;
30   char const *pretty = __PRETTY_FUNCTION__;
31   
32   printf ("specialized\n");
33   printf ("__FUNCTION__ %s\n", function);
34   printf ("__PRETTY_FUNCTION__ %s\n", pretty);
35   
36   if (strcmp (function, "f1<int>"))
37     bad = true;
38   if (strcmp (pretty, "void f1(T) [with T = int]"))
39     bad = true;
42 int main ()
44   f1(0);    // f1<int>
45   f1(0.0f); // f1<float>
46   return bad;