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 -DNOERROR %s -fexperimental-new-constant-interpreter
4 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP -DNOERROR %s
5 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP -DNOERROR %s -fexperimental-new-constant-interpreter
7 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
8 // RUN: -ffp-eval-method=source -DNOERROR %s
9 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
10 // RUN: -ffp-eval-method=source -DNOERROR %s -fexperimental-new-constant-interpreter
12 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
13 // RUN: -ffp-eval-method=source \
15 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
16 // RUN: -ffp-eval-method=source \
17 // RUN: -DNOERROR %s -fexperimental-new-constant-interpreter
19 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
20 // RUN: -ffp-eval-method=double %s
21 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
22 // RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter
24 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
25 // RUN: -ffp-eval-method=double %s
26 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
27 // RUN: -ffp-eval-method=double %s -fexperimental-new-constant-interpreter
29 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
30 // RUN: -ffp-eval-method=extended %s
31 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only \
32 // RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter
34 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
35 // RUN: -ffp-eval-method=extended %s
36 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -fsyntax-only -x c++ -DCPP \
37 // RUN: -ffp-eval-method=extended %s -fexperimental-new-constant-interpreter
40 // expected-no-diagnostics
41 typedef float float_t
;
42 typedef double double_t
;
45 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}}
47 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}}
49 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}}
51 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}}
56 #pragma clang fp eval_method(source)
63 #pragma clang fp eval_method(source)
70 #pragma clang fp eval_method(source)
71 char buff
[sizeof(float_t
)];
72 char bufd
[sizeof(double_t
)];
77 #pragma clang fp eval_method(source)
86 #pragma clang fp eval_method(source)
87 int t
= _Generic( 1.0L, float_t
:1, default:0);
88 int v
= _Generic( 1.0L, double_t
:1, default:0);
93 #pragma clang fp eval_method(source)
95 double d
= (double_t
)2;
99 #pragma clang fp eval_method(source)
100 float c1
= (float_t
)12;
101 double c2
= (double_t
)13;
105 #pragma clang fp eval_method(source)
113 #pragma clang fp eval_method(source)
114 auto resf
= [](float_t f
) { return f
; };
115 auto resd
= [](double_t g
) { return g
; };
119 #pragma clang fp eval_method(source)