blob: 6d853e8a6828235cb845a4f9064ca36ed63256cd [file] [log] [blame]
Bill Wendling6ff17512018-11-21 20:44:18 +00001// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s
2
3// Don't crash if the argument to __builtin_constant_p isn't scalar.
4template <typename T>
5constexpr bool is_constant(const T v) {
6 return __builtin_constant_p(v);
7}
8
9template <typename T>
10class numeric {
11 public:
12 using type = T;
13
14 template <typename S>
15 constexpr numeric(S value)
16 : value_(static_cast<T>(value)) {}
17
18 private:
19 const T value_;
20};
21
22bool bcp() {
23 return is_constant(numeric<int>(1));
24}