Clang Project

clang_source_code/test/Sema/128bitfloat.cpp
1// RUN: %clang_cc1 -verify -std=gnu++11 %s
2// RUN: %clang_cc1 -verify -std=c++11 %s
3// RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s
4// RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s
5// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s
6// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s
7
8#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
9__float128 f;
10template<typename> struct __is_floating_point_helper {};
11template<> struct __is_floating_point_helper<__float128> {};
12int g(int x, __float128 *y) {
13  return x + *y;
14}
15
16// expected-no-diagnostics
17#else
18#if !defined(__STRICT_ANSI__)
19__float128 f;  // expected-error {{__float128 is not supported on this target}}
20// But this should work:
21template<typename> struct __is_floating_point_helper {};
22template<> struct __is_floating_point_helper<__float128> {};  // expected-error {{__float128 is not supported on this target}}
23
24// FIXME: This could have a better diag.
25int g(int x, __float128 *y) {  // expected-error {{__float128 is not supported on this target}}
26  return x + *y;
27}
28
29#else
30__float128 f;  // expected-error {{__float128 is not supported on this target}}
31template<typename> struct __is_floating_point_helper {};
32template<> struct __is_floating_point_helper<__float128> {};  // expected-error {{__float128 is not supported on this target}}
33
34int g(int x, __float128 *y) {  // expected-error {{__float128 is not supported on this target}}
35  return x + *y;
36}
37
38#endif
39#endif
40