1 // RUN: %clang_cc1 %s -std=c++17 -pedantic -verify -triple=x86_64-apple-darwin9
2 
3 // Simple is_const implementation.
4 struct true_type {
5   static const bool value = true;
6 };
7 
8 struct false_type {
9   static const bool value = false;
10 };
11 
12 template <class T> struct is_const : false_type {};
13 template <class T> struct is_const<const T> : true_type {};
14 
15 // expected-no-diagnostics
16 
17 void test_builtin_elementwise_abs() {
18   const int a = 2;
19   int b = 1;
20   static_assert(!is_const<decltype(__builtin_elementwise_abs(a))>::value);
21   static_assert(!is_const<decltype(__builtin_elementwise_abs(b))>::value);
22 }
23 
24 void test_builtin_elementwise_max() {
25   const int a = 2;
26   int b = 1;
27   static_assert(!is_const<decltype(__builtin_elementwise_max(a, b))>::value);
28   static_assert(!is_const<decltype(__builtin_elementwise_max(b, a))>::value);
29   static_assert(!is_const<decltype(__builtin_elementwise_max(a, a))>::value);
30 }
31 
32 void test_builtin_elementwise_min() {
33   const int a = 2;
34   int b = 1;
35   static_assert(!is_const<decltype(__builtin_elementwise_min(a, b))>::value);
36   static_assert(!is_const<decltype(__builtin_elementwise_min(b, a))>::value);
37   static_assert(!is_const<decltype(__builtin_elementwise_min(a, a))>::value);
38 }
39 
40 void test_builtin_elementwise_ceil() {
41   const float a = 42.0;
42   float b = 42.3;
43   static_assert(!is_const<decltype(__builtin_elementwise_ceil(a))>::value);
44   static_assert(!is_const<decltype(__builtin_elementwise_ceil(b))>::value);
45 }
46