Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / AST / Interp / builtins.cpp
blob5e2ffe50f3740577e907c8bd01a4a02549c5656f
1 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify
2 // RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -S -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated
4 // RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -S -emit-llvm -o - | FileCheck %s
6 // expected-no-diagnostics
7 // ref-no-diagnostics
9 using size_t = decltype(sizeof(int));
11 namespace std {
12 inline constexpr bool is_constant_evaluated() noexcept {
13 return __builtin_is_constant_evaluated();
15 } // namespace std
17 constexpr bool b = std::is_constant_evaluated();
18 static_assert(b, "");
19 static_assert(std::is_constant_evaluated() , "");
22 bool is_this_constant() {
23 return __builtin_is_constant_evaluated(); // CHECK: ret i1 false
26 constexpr bool assume() {
27 __builtin_assume(true);
28 __builtin_assume(false);
29 return true;
31 static_assert(assume(), "");