xref: /aosp_15_r20/external/clang/test/Sema/128bitfloat.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
2*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
3*67e74705SXin Li 
4*67e74705SXin Li #ifdef __FLOAT128__
5*67e74705SXin Li __float128 f;
6*67e74705SXin Li template<typename> struct __is_floating_point_helper {};
7*67e74705SXin Li template<> struct __is_floating_point_helper<__float128> {};
g(int x,__float128 * y)8*67e74705SXin Li int g(int x, __float128 *y) {
9*67e74705SXin Li   return x + *y;
10*67e74705SXin Li }
11*67e74705SXin Li 
12*67e74705SXin Li // expected-no-diagnostics
13*67e74705SXin Li #else
14*67e74705SXin Li #if !defined(__STRICT_ANSI__)
15*67e74705SXin Li __float128 f;  // expected-error {{__float128 is not supported on this target}}
16*67e74705SXin Li // But this should work:
17*67e74705SXin Li template<typename> struct __is_floating_point_helper {};
18*67e74705SXin Li template<> struct __is_floating_point_helper<__float128> {};  // expected-error {{__float128 is not supported on this target}}
19*67e74705SXin Li 
20*67e74705SXin Li // FIXME: This could have a better diag.
g(int x,__float128 * y)21*67e74705SXin Li int g(int x, __float128 *y) {  // expected-error {{__float128 is not supported on this target}}
22*67e74705SXin Li   return x + *y;
23*67e74705SXin Li }
24*67e74705SXin Li 
25*67e74705SXin Li #else
26*67e74705SXin Li __float128 f;  // expected-error {{__float128 is not supported on this target}}
27*67e74705SXin Li template<typename> struct __is_floating_point_helper {};
28*67e74705SXin Li template<> struct __is_floating_point_helper<__float128> {};  // expected-error {{__float128 is not supported on this target}}
29*67e74705SXin Li 
g(int x,__float128 * y)30*67e74705SXin Li int g(int x, __float128 *y) {  // expected-error {{__float128 is not supported on this target}}
31*67e74705SXin Li   return x + *y;
32*67e74705SXin Li }
33*67e74705SXin Li 
34*67e74705SXin Li #endif
35*67e74705SXin Li #endif
36