llvm-project/clang/test/Sema/128bitfloat.cpp
Reid Kleckner 9eabbb6066 Enable __float128 for mingw for GCC compatibility and define __SIZEOF_FLOAT128__ on x86
GCC defines __FLOAT128__ on Power and __SIZEOF_FLOAT128__ on x86. We're
just following the inconsistency for now so users have some way to test.

Effectively merges this patch as requested by Martell Malone:
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/0107-enable-__float128-for-X86-MinGW.patch

llvm-svn: 304012
2017-05-26 17:38:15 +00:00

40 lines
1.5 KiB
C++

// RUN: %clang_cc1 -verify -std=gnu++11 %s
// RUN: %clang_cc1 -verify -std=c++11 %s
// RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s
// RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s
// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s
// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s
#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
__float128 f;
template<typename> struct __is_floating_point_helper {};
template<> struct __is_floating_point_helper<__float128> {};
int g(int x, __float128 *y) {
return x + *y;
}
// expected-no-diagnostics
#else
#if !defined(__STRICT_ANSI__)
__float128 f; // expected-error {{__float128 is not supported on this target}}
// But this should work:
template<typename> struct __is_floating_point_helper {};
template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
// FIXME: This could have a better diag.
int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
return x + *y;
}
#else
__float128 f; // expected-error {{__float128 is not supported on this target}}
template<typename> struct __is_floating_point_helper {};
template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
return x + *y;
}
#endif
#endif