Files
clang-p2996/clang/test/CodeGenCXX/builtin-constant-p.cpp
Fangrui Song 407659ab0a Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""
It seems the two failing tests can be simply fixed after r348037

Fix 3 cases in Analysis/builtin-functions.cpp
Delete the bad CodeGen/builtin-constant-p.c for now

llvm-svn: 348053
2018-11-30 23:41:18 +00:00

25 lines
479 B
C++

// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s
// Don't crash if the argument to __builtin_constant_p isn't scalar.
template <typename T>
constexpr bool is_constant(const T v) {
return __builtin_constant_p(v);
}
template <typename T>
class numeric {
public:
using type = T;
template <typename S>
constexpr numeric(S value)
: value_(static_cast<T>(value)) {}
private:
const T value_;
};
bool bcp() {
return is_constant(numeric<int>(1));
}