1 // { dg-do run }
2 #include <cassert>
3 
4 struct A
5 {
6   double a;
7   double b;
8 };
9 
10 struct B
11 {
~BB12   virtual ~B() { }
13 };
14 
15 class C
16 { };
17 
18 union U
19 { };
20 
21 template<typename T>
22   bool
f()23   f()
24   { return __is_empty(T); }
25 
26 template<typename T>
27   class My
28   {
29   public:
30     bool
f()31     f()
32     { return !!__is_empty(T); }
33   };
34 
35 template<typename T>
36   class My2
37   {
38   public:
39     static const bool trait = __is_empty(T);
40   };
41 
42 template<typename T>
43   const bool My2<T>::trait;
44 
45 template<typename T, bool b = __is_empty(T)>
46   struct My3_help
47   { static const bool trait = b; };
48 
49 template<typename T, bool b>
50   const bool My3_help<T, b>::trait;
51 
52 template<typename T>
53   class My3
54   {
55   public:
56     bool
f()57     f()
58     { return My3_help<T>::trait; }
59   };
60 
61 #define PTEST(T) (__is_empty(T) && f<T>() \
62                   && My<T>().f() && My2<T>::trait && My3<T>().f())
63 
64 #define NTEST(T) (!__is_empty(T) && !f<T>() \
65                   && !My<T>().f() && !My2<T>::trait && !My3<T>().f())
66 
main()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 }
79