1 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -DNOERROR %s
2 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
3 // RUN: -x c++ -DCPP -DNOERROR %s
5 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
6 // RUN: -ffp-eval-method=source -DNOERROR %s
7 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
8 // RUN: -ffp-eval-method=source \
11 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
12 // RUN: -ffp-eval-method=double %s
13 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
14 // RUN: -ffp-eval-method=double %s
16 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
17 // RUN: -ffp-eval-method=extended %s
18 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
19 // RUN: -ffp-eval-method=extended %s
23 // expected-no-diagnostics
24 typedef float float_t
;
25 typedef double double_t
;
28 typedef float float_t
; //expected-error 9 {{cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
30 typedef double double_t
; //expected-error 9 {{cannot use type 'double_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
32 typedef float float_t
; //expected-error 7 {{cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
34 typedef double double_t
; //expected-error 7 {{cannot use type 'double_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
39 #pragma clang fp eval_method(source)
46 #pragma clang fp eval_method(source)
53 #pragma clang fp eval_method(source)
54 char buff
[sizeof(float_t
)];
55 char bufd
[sizeof(double_t
)];
60 #pragma clang fp eval_method(source)
69 #pragma clang fp eval_method(source)
70 int t
= _Generic( 1.0L, float_t
:1, default:0);
71 int v
= _Generic( 1.0L, double_t
:1, default:0);
76 #pragma clang fp eval_method(source)
78 double d
= (double_t
)2;
82 #pragma clang fp eval_method(source)
83 float c1
= (float_t
)12;
84 double c2
= (double_t
)13;
88 #pragma clang fp eval_method(source)
96 #pragma clang fp eval_method(source)
97 auto resf
= [](float_t f
) { return f
; };
98 auto resd
= [](double_t g
) { return g
; };
102 #pragma clang fp eval_method(source)