Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \ |
Stefan Pintilie | a6ce3fe | 2018-06-13 16:05:05 +0000 | [diff] [blame] | 2 | // RUN: -triple powerpc64le-unknown-linux-gnu -target-cpu pwr9 \ |
Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 3 | // RUN: -target-feature +float128 %s |
Benjamin Kramer | 9805795 | 2018-01-17 22:56:57 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -fsyntax-only -std=c++11 -triple x86_64-unknown-linux-gnu -Wno-unused-value -Wno-parentheses %s |
Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 5 | |
| 6 | __float128 qf(); |
| 7 | long double ldf(); |
| 8 | |
Benjamin Kramer | 9805795 | 2018-01-17 22:56:57 +0000 | [diff] [blame] | 9 | #ifdef __PPC__ |
Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 10 | // FIXME: once operations between long double and __float128 are implemented for |
| 11 | // targets where the types are different, these next two will change |
| 12 | long double ld{qf()}; // expected-error {{cannot initialize a variable of type 'long double' with an rvalue of type '__float128'}} |
| 13 | __float128 q{ldf()}; // expected-error {{cannot initialize a variable of type '__float128' with an rvalue of type 'long double'}} |
| 14 | |
| 15 | auto test1(__float128 q, long double ld) -> decltype(q + ld) { // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 16 | return q + ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 17 | } |
| 18 | |
| 19 | auto test2(long double a, __float128 b) -> decltype(a + b) { // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 20 | return a + b; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 21 | } |
Benjamin Kramer | 9805795 | 2018-01-17 22:56:57 +0000 | [diff] [blame] | 22 | #endif |
Nemanja Ivanovic | bb1ea2d | 2016-05-09 08:52:33 +0000 | [diff] [blame] | 23 | |
| 24 | void test3(bool b) { |
| 25 | long double ld; |
| 26 | __float128 q; |
| 27 | |
| 28 | ld + q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 29 | q + ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 30 | ld - q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 31 | q - ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 32 | ld * q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 33 | q * ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 34 | ld / q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}} |
| 35 | q / ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}} |
| 36 | ld = q; // expected-error {{assigning to 'long double' from incompatible type '__float128'}} |
| 37 | q = ld; // expected-error {{assigning to '__float128' from incompatible type 'long double'}} |
| 38 | q + b ? q : ld; // expected-error {{incompatible operand types ('__float128' and 'long double')}} |
| 39 | } |