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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [is_enum.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
#include 
3
 
4
struct A
5
{
6
  double a;
7
  double b;
8
};
9
 
10
class B
11
{ };
12
 
13
enum E
14
{
15
  e0
16
};
17
 
18
template
19
  bool
20
  f()
21
  { return __is_enum(T); }
22
 
23
template
24
  class My
25
  {
26
  public:
27
    bool
28
    f()
29
    { return !!__is_enum(T); }
30
  };
31
 
32
template
33
  class My2
34
  {
35
  public:
36
    static const bool trait = __is_enum(T);
37
  };
38
 
39
template
40
  const bool My2::trait;
41
 
42
template
43
  struct My3_help
44
  { static const bool trait = b; };
45
 
46
template
47
  const bool My3_help::trait;
48
 
49
template
50
  class My3
51
  {
52
  public:
53
    bool
54
    f()
55
    { return My3_help::trait; }
56
  };
57
 
58
#define PTEST(T) (__is_enum(T) && f() \
59
                  && My().f() && My2::trait && My3().f())
60
 
61
#define NTEST(T) (!__is_enum(T) && !f() \
62
                  && !My().f() && !My2::trait && !My3().f())
63
 
64
int main()
65
{
66
  assert (NTEST (int));
67
  assert (NTEST (void));
68
  assert (NTEST (A));
69
  assert (NTEST (B));
70
  assert (PTEST (E));
71
 
72
  return 0;
73
}

powered by: WebSVN 2.1.0

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