Introduce class rtx_reader
[official-gcc.git] / gcc / testsuite / g++.dg / ext / is_pod.C
blobd073889c839f704000b169217982806beab5a2e7
1 // { dg-do run { target c++11 } }
2 #include <cassert>
4 struct A
6   double a;
7   double b;
8 };
10 struct B
12   B() { }
15 struct C
16 : public A { };
18 template<typename T>
19   bool
20   f()
21   { return __is_pod(T); } 
23 template<typename T>
24   class My
25   {
26   public:
27     bool
28     f()
29     { return !!__is_pod(T); }
30   };
32 template<typename T>
33   class My2
34   {
35   public:
36     static const bool trait = __is_pod(T);
37   };
39 template<typename T>
40   const bool My2<T>::trait;
42 template<typename T, bool b = __is_pod(T)>
43   struct My3_help
44   { static const bool trait = b; };
46 template<typename T, bool b>
47   const bool My3_help<T, b>::trait;
49 template<typename T>
50   class My3
51   {
52   public:
53     bool
54     f()
55     { return My3_help<T>::trait; }
56   };
58 #define PTEST(T) (__is_pod(T) && f<T>() \
59                   && My<T>().f() && My2<T>::trait && My3<T>().f())
61 #define NTEST(T) (!__is_pod(T) && !f<T>() \
62                   && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
64 int main()
66   assert (PTEST (int));
67   assert (NTEST (void));
68   assert (PTEST (A));
69   assert (PTEST (A[]));
70   assert (NTEST (B));
71   assert (PTEST (C));
72   assert (PTEST (C[]));
74   return 0;