OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <float.h> | 5 #include <float.h> |
6 | 6 |
7 #include "base/safe_numerics.h" | 7 #include "base/safe_numerics.h" |
8 | 8 |
9 using base::internal::IsValidNumericCast; | 9 using base::internal::IsValidNumericCast; |
10 | 10 |
11 #if defined(NCTEST_NO_FLOATING_POINT_1) // [r"size of array is negative"] | 11 #if defined(NCTEST_NO_FLOATING_POINT_1) // [r"size of array is negative"] |
12 | 12 |
13 void WontCompile() { | 13 void WontCompile() { |
14 IsValidNumericCast<float>(0.0); | 14 IsValidNumericCast<float>(0.0); |
15 } | 15 } |
16 | 16 |
17 #elif defined(NCTEST_NO_FLOATING_POINT_2) // [r"size of array is negative"] | 17 #elif defined(NCTEST_NO_FLOATING_POINT_2) // [r"size of array is negative"] |
18 | 18 |
19 void WontCompile() { | 19 void WontCompile() { |
20 IsValidNumericCast<double>(0.0f); | 20 IsValidNumericCast<double>(0.0f); |
21 } | 21 } |
22 | 22 |
23 #elif defined(NCTEST_NO_FLOATING_POINT_3) // [r"size of array is negative"] | |
24 | |
25 void WontCompile() { | |
26 IsValidNumericCast<int>(DBL_MAX); | |
27 } | |
28 | |
29 #endif | 23 #endif |
OLD | NEW |