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
10 static bool bad = false;
12 template<class T> void f1 (T)
14 char const *function = __FUNCTION__;
15 char const *pretty = __PRETTY_FUNCTION__;
18 printf ("__FUNCTION__ %s\n", function);
19 printf ("__PRETTY_FUNCTION__ %s\n", pretty);
21 if (strcmp (function, "f1"))
23 if (strcmp (pretty, "void f1(T) [with T = float]")) // only for float instantiation
27 template<> void f1<int> (int)
29 char const *function = __FUNCTION__;
30 char const *pretty = __PRETTY_FUNCTION__;
32 printf ("specialized\n");
33 printf ("__FUNCTION__ %s\n", function);
34 printf ("__PRETTY_FUNCTION__ %s\n", pretty);
36 if (strcmp (function, "f1<int>"))
38 if (strcmp (pretty, "void f1(T) [with T = int]"))
45 f1(0.0f); // f1<float>