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=double -DNOERROR %s
7 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
8 // RUN: -ffp-eval-method=double -DNOERROR %s
10 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
11 // RUN: -ffp-eval-method=source %s
12 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
13 // RUN: -ffp-eval-method=source %s
15 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
16 // RUN: -ffp-eval-method=extended %s
17 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
18 // RUN: -ffp-eval-method=extended %s
21 // expected-no-diagnostics
22 typedef float float_t
;
23 typedef double double_t
;
26 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}}
28 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}}
30 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}}
32 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}}
37 #pragma clang fp eval_method(double)
44 #pragma clang fp eval_method(double)
51 #pragma clang fp eval_method(double)
52 char buff
[sizeof(float_t
)];
53 char bufd
[sizeof(double_t
)];
58 #pragma clang fp eval_method(double)
67 #pragma clang fp eval_method(double)
68 int t
= _Generic( 1.0L, float_t
:1, default:0);
69 int v
= _Generic( 1.0L, double_t
:1, default:0);
74 #pragma clang fp eval_method(double)
76 double d
= (double_t
)2;
80 #pragma clang fp eval_method(double)
81 float c1
= (float_t
)12;
82 double c2
= (double_t
)13;
86 #pragma clang fp eval_method(double)
94 #pragma clang fp eval_method(double)
95 auto resf
= [](float_t f
) { return f
; };
96 auto resd
= [](double_t g
) { return g
; };
100 #pragma clang fp eval_method(double)