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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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