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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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