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_max() {
18   const int a = 2;
19   int b = 1;
20   static_assert(!is_const<decltype(__builtin_elementwise_max(a, b))>::value);
21   static_assert(!is_const<decltype(__builtin_elementwise_max(b, a))>::value);
22   static_assert(!is_const<decltype(__builtin_elementwise_max(a, a))>::value);
23 }
24 
25 void test_builtin_elementwise_min() {
26   const int a = 2;
27   int b = 1;
28   static_assert(!is_const<decltype(__builtin_elementwise_min(a, b))>::value);
29   static_assert(!is_const<decltype(__builtin_elementwise_min(b, a))>::value);
30   static_assert(!is_const<decltype(__builtin_elementwise_min(a, a))>::value);
31 }
32