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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [is_abstract.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
union U
11
{
12
  double a;
13
  double b;
14
};
15
 
16
class B
17
{
18
  B();
19
};
20
 
21
class C
22
{
23
  virtual void rotate(int) = 0;
24
};
25
 
26
class D
27
{
28
  virtual void rotate(int) { }
29
};
30
 
31
template
32
  bool
33
  f()
34
  { return __is_abstract(T); }
35
 
36
template
37
  class My
38
  {
39
  public:
40
    bool
41
    f()
42
    { return !!__is_abstract(T); }
43
  };
44
 
45
template
46
  class My2
47
  {
48
  public:
49
    static const bool trait = __is_abstract(T);
50
  };
51
 
52
template
53
  const bool My2::trait;
54
 
55
template
56
  struct My3_help
57
  { static const bool trait = b; };
58
 
59
template
60
  const bool My3_help::trait;
61
 
62
template
63
  class My3
64
  {
65
  public:
66
    bool
67
    f()
68
    { return My3_help::trait; }
69
  };
70
 
71
#define PTEST(T) (__is_abstract(T) && f() \
72
                  && My().f() && My2::trait && My3().f())
73
 
74
#define NTEST(T) (!__is_abstract(T) && !f() \
75
                  && !My().f() && !My2::trait && !My3().f())
76
 
77
int main()
78
{
79
  assert (NTEST (int));
80
  assert (NTEST (void));
81
  assert (NTEST (A));
82
  assert (NTEST (U));
83
  assert (NTEST (B));
84
  assert (NTEST (B[]));
85
  assert (PTEST (C));
86
  assert (NTEST (D));
87
 
88
  return 0;
89
}

powered by: WebSVN 2.1.0

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