1 // RUN: %clang_cc1 -std=c99 -analyze -analyzer-checker=core,alpha.core.BoolAssignment -analyzer-store=region -verify %s
3 // Test stdbool.h's _Bool
5 // Prior to C99, stdbool.h uses this typedef, but even in ANSI C mode, _Bool
6 // appears to be defined.
8 // #if __STDC_VERSION__ < 199901L
12 void test_stdbool_initialization(int y) {
14 _Bool x = y; // expected-warning {{Assignment of a non-Boolean value}}
18 _Bool x = y; // expected-warning {{Assignment of a non-Boolean value}}
21 _Bool x = y; // no-warning
24 void test_stdbool_assignment(int y) {
25 _Bool x = 0; // no-warning
27 x = y; // expected-warning {{Assignment of a non-Boolean value}}
31 x = y; // expected-warning {{Assignment of a non-Boolean value}}