63 lines · cpp
1// RUN: %clang_cc1 -verify -std=gnu++11 %s2// RUN: %clang_cc1 -verify -std=c++11 %s3// RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s4// RUN: %clang_cc1 -triple powerpc64-ibm-aix -target-feature +float128 -verify -std=c++11 %s5// RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s6// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s7// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s8 9#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)10 11#if defined(__powerpc__)12template <typename> struct __is_float128 { static constexpr bool value = false; };13template <> struct __is_float128<__float128> { static constexpr bool value = true; };14static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128");15#endif16 17__float128 f;18template<typename> struct __is_floating_point_helper {};19template<> struct __is_floating_point_helper<__float128> {};20int g(int x, __float128 *y) {21 return x + *y;22}23 24// expected-no-error {{__float128 is not supported on this target}}25#else26#if !defined(__STRICT_ANSI__)27__float128 f; // expected-error {{__float128 is not supported on this target}}28// But this should work:29template<typename> struct __is_floating_point_helper {};30template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}31 32// FIXME: This could have a better diag.33int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}34 return x + *y;35}36 37#else38__float128 f; // expected-error {{__float128 is not supported on this target}}39template<typename> struct __is_floating_point_helper {};40template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}41 42int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}43 return x + *y;44}45 46#endif47#endif48 49#ifdef __powerpc__50__ibm128 i;51template <> struct __is_floating_point_helper<__ibm128> {};52int w(int x, __ibm128 *y) {53 return x + *y;54}55// expected-no-error {{__ibm128 is not supported on this target}}56#else57__ibm128 i; // expected-error {{__ibm128 is not supported on this target}}58template <> struct __is_floating_point_helper<__ibm128> {}; // expected-error {{__ibm128 is not supported on this target}}59int w(int x, __ibm128 *y) { // expected-error {{__ibm128 is not supported on this target}}60 return x + *y;61}62#endif63