clang/test/SemaCXX/constexpr-unsigned-high-bit.cpp
raw| 1 | // RUN: %clang_cc1 -std=c++14 -fsyntax-only %s |
| 2 | // RUN: %clang_cc1 -std=c++14 -fsyntax-only -fexperimental-new-constant-interpreter %s |
| 3 | |
| 4 | #include <limits.h> |
| 5 | |
| 6 | constexpr unsigned inc() { |
| 7 | unsigned i = INT_MAX; |
| 8 | ++i; // should not warn value is outside range |
| 9 | return i; |
| 10 | } |
| 11 | |
| 12 | constexpr unsigned dec() { |
| 13 | unsigned i = INT_MIN; |
| 14 | --i; // should not warn value is outside range |
| 15 | return i; |
| 16 | } |