OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.ext/] [pretty3.C] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run  }
2
// Copyright (C) 1999 Free Software Foundation, Inc.
3
// Contributed by Nathan Sidwell 21 Nov 1999 
4
 
5
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates
6
 
7
#include 
8
#include 
9
 
10
static bool bad = false;
11
 
12
template void f1 (T)
13
{
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;
25
}
26
 
27
template<> void f1 (int)
28
{
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"))
37
    bad = true;
38
  if (strcmp (pretty, "void f1(T) [with T = int]"))
39
    bad = true;
40
}
41
 
42
int main ()
43
{
44
  f1(0);    // f1
45
  f1(0.0f); // f1
46
  return bad;
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.