• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 \
2 // RUN: -triple powerpc64le-unknown-linux-gnu -target-cpu pwr8 \
3 // RUN: -target-feature +float128 %s
4 
5 __float128 qf();
6 long double ldf();
7 
8 // FIXME: once operations between long double and __float128 are implemented for
9 //        targets where the types are different, these next two will change
10 long double ld{qf()}; // expected-error {{cannot initialize a variable of type 'long double' with an rvalue of type '__float128'}}
11 __float128 q{ldf()};  // expected-error {{cannot initialize a variable of type '__float128' with an rvalue of type 'long double'}}
12 
test1(__float128 q,long double ld)13 auto test1(__float128 q, long double ld) -> decltype(q + ld) { // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
14   return q + ld;      // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
15 }
16 
test2(long double a,__float128 b)17 auto test2(long double a, __float128 b) -> decltype(a + b) { // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
18   return a + b;      // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
19 }
20 
test3(bool b)21 void test3(bool b) {
22   long double ld;
23   __float128 q;
24 
25   ld + q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
26   q + ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
27   ld - q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
28   q - ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
29   ld * q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
30   q * ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
31   ld / q; // expected-error {{invalid operands to binary expression ('long double' and '__float128')}}
32   q / ld; // expected-error {{invalid operands to binary expression ('__float128' and 'long double')}}
33   ld = q; // expected-error {{assigning to 'long double' from incompatible type '__float128'}}
34   q = ld; // expected-error {{assigning to '__float128' from incompatible type 'long double'}}
35   q + b ? q : ld; // expected-error {{incompatible operand types ('__float128' and 'long double')}}
36 }
37