You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
613 B
31 lines
613 B
6 years ago
|
/*
|
||
|
* Copyright (c) 2018-present, Facebook, Inc.
|
||
|
*
|
||
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
|
*/
|
||
|
void sizeof_bool_Good() {
|
||
|
int a[2];
|
||
|
int z = sizeof(bool); // z is 1 (byte)
|
||
|
a[z] = 0;
|
||
|
}
|
||
|
|
||
|
void sizeof_bool_Bad() {
|
||
|
int a[1];
|
||
|
int z = sizeof(bool); // z is 1 (byte)
|
||
|
a[z] = 0;
|
||
|
}
|
||
|
|
||
|
// FP due to incomplete frontend translation of casting
|
||
|
void range_bool_Good_FP() {
|
||
|
int a[2];
|
||
|
bool x = true + true; // x is 1 (true)
|
||
|
a[x] = 0;
|
||
|
}
|
||
|
|
||
|
void range_bool_Bad() {
|
||
|
int a[1];
|
||
|
bool x = true + false; // x is 1 (true)
|
||
|
a[x] = 0;
|
||
|
}
|