Debian Codegraph @

gcc/testsuite/g++.dg/expr/bool1.C

raw
1 // PR c++/29295
2 // { dg-do run { target c++14_down } }
3 // { dg-do compile { target c++17 } }
4 // make sure that a typedef for a bool will have the
5 // the same results as a bool itself.
6
7 extern "C" void abort();
8 typedef bool my_bool;
9 int main()
10 {
11 my_bool b = false;
12 int i;
13
14 b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
15 // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
16 b++; // { dg-warning "3:use of an operand of type .bool. in .operator\\+\\+. is deprecated" "" { target { ! c++17 } } }
17 // { dg-error "3:use of an operand of type .bool. in .operator\\+\\+. is forbidden" "" { target c++17 } .-1 }
18 i = b;
19 if (i != 1)
20 abort ();
21 return 0;
22 }
23
24