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=extended -DNOERROR %s
7 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
8 // RUN: -ffp-eval-method=extended -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=double %s
17 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
18 // RUN: -ffp-eval-method=double %s
22 // expected-no-diagnostics
23 typedef float float_t
;
24 typedef double double_t
;
27 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}}
29 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}}
31 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}}
33 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}}
38 #pragma clang fp eval_method(extended)
45 #pragma clang fp eval_method(extended)
52 #pragma clang fp eval_method(extended)
53 char buff
[sizeof(float_t
)];
54 char bufd
[sizeof(double_t
)];
59 #pragma clang fp eval_method(extended)
68 #pragma clang fp eval_method(extended)
69 int t
= _Generic( 1.0L, float_t
:1, default:0);
70 int v
= _Generic( 1.0L, double_t
:1, default:0);
75 #pragma clang fp eval_method(extended)
77 double d
= (double_t
)2;
81 #pragma clang fp eval_method(extended)
82 float c1
= (float_t
)12;
83 double c2
= (double_t
)13;
87 #pragma clang fp eval_method(extended)
95 #pragma clang fp eval_method(extended)
96 auto resf
= [](float_t f
) { return f
; };
97 auto resd
= [](double_t g
) { return g
; };
101 #pragma clang fp eval_method(extended)