blob: bc44c73d8cace4b06470575e5666350d213cd2f6 [file] [log] [blame]
Daniel Dunbara45cf5b2009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Anders Carlsson4f177f82008-08-23 21:12:35 +00002
3// Bool literals can be enum values.
4enum {
5 ReadWrite = false,
6 ReadOnly = true
7};
Sebastian Redle10c2c32008-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}}
Douglas Gregor7de59662009-05-29 20:38:28 +000016
17 bool *b1 = (int *)0; // expected-error{{expected 'bool *'}}
Sebastian Redle10c2c32008-12-20 09:35:34 +000018}