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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [ext/] [fnname3.C] - Blame information for rev 841

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

Line No. Rev Author Line
1 149 jeremybenn
// Test whether __func__ works for constructors and destructors.
2
 
3
// Copyright (C) 2003 Free Software Foundation, Inc.
4
// Contributed by Matt Austern , 3 Aug 2003
5
// { dg-do run }
6
 
7
struct uk9i
8
{
9
  uk9i();
10
  ~uk9i();
11
 
12
  static const char* fname;
13
  static bool obj_exists;
14
};
15
 
16
uk9i::uk9i()
17
{
18
  obj_exists = true;
19
  fname = __func__;
20
}
21
 
22
uk9i::~uk9i()
23
{
24
  obj_exists = false;
25
  fname = __func__;
26
}
27
 
28
const char* uk9i::fname = 0;
29
bool uk9i::obj_exists = false;
30
 
31
int main()
32
{
33
  bool ok = true;
34
 
35
  ok = ok && uk9i::fname == 0;
36
  ok = ok && !uk9i::obj_exists;
37
 
38
  {
39
    uk9i tmp;
40
    ok = ok && uk9i::obj_exists;
41
    ok = ok && uk9i::fname != 0;
42
    if (ok)
43
      {
44
        ok = ok && uk9i::fname[0] == 'u';
45
        ok = ok && uk9i::fname[1] == 'k';
46
        ok = ok && uk9i::fname[2] == '9';
47
        ok = ok && uk9i::fname[3] == 'i';
48
        ok = ok && uk9i::fname[4] == '\0';
49
      }
50
  }
51
 
52
  ok = ok && !uk9i::obj_exists;
53
  ok = ok && uk9i::fname != 0;
54
  if (ok)
55
    {
56
      ok = ok && uk9i::fname[0] == '~';
57
      ok = ok && uk9i::fname[1] == 'u';
58
      ok = ok && uk9i::fname[2] == 'k';
59
      ok = ok && uk9i::fname[3] == '9';
60
      ok = ok && uk9i::fname[4] == 'i';
61
      ok = ok && uk9i::fname[5] == '\0';
62
    }
63
 
64
  return ok ? 0 : 1;
65
}

powered by: WebSVN 2.1.0

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