1// { dg-do assemble  }
2// Testcase for uses of bool.
3
4int i,j,k;
5
6/* Check that types of certain expressions are bool.  */
7void f ()
8{
9  i ? j == k : true;
10  i ? j < k : true;
11  i ? j && k : true;
12}
13
14/* Check that g++ can find a conversion to bool when one exists.  */
15struct A { operator char * (); } a;
16struct B { operator int (); } b;
17struct C { operator float (); } c;
18struct D { operator bool (); } d;
19struct E { operator int E::* (); } e;
20
21void g ()
22{
23  a || true;
24  b || true;
25  c || true;			// { dg-bogus "" }
26  d || true;
27  e || true;
28}
29
30/* Check for support in templates.  */
31template <class T> struct F { };
32template class F<bool>;
33
34template <class T> void f (T, bool) { }
35template void f (bool, bool);
36
37/* Special cases.  */
38void h ()
39{
40  /* Used to cause infinite recursion.  */
41  i&1 || true;
42  /* Should find conversion path to int.  */
43  d == true;
44}
45
46bool boo = -1;
47