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

Subversion Repositories openrisc

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

powered by: WebSVN 2.1.0

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