blob: e606a518d7f5f403bda8092767bd8f757e922046 [file] [log] [blame]
Anders Carlssonb88d45e2008-08-23 21:12:35 +00001// RUN: clang -fsyntax-only -verify %s
2
3// Bool literals can be enum values.
4enum {
5 ReadWrite = false,
6 ReadOnly = true
7};
Sebastian Redle6d5a4a2008-12-20 09:35:34 +00008
9// bool cannot be decremented, and gives a warning on increment
10void test(bool b)
11{
12 ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
13 b++; // expected-warning {{incrementing expression of type bool is deprecated}}
14 --b; // expected-error {{cannot decrement expression of type bool}}
15 b--; // expected-error {{cannot decrement expression of type bool}}
16}