1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -ffp-exception-behavior=strict -DSTRICT -fsyntax-only -verify %s
3 // RUN: %clang_cc1 -triple x86_64-linux-gnu -x c++ -DCPP -DSTRICT -ffp-exception-behavior=strict -fsyntax-only -verify %s
5 #define CONST constexpr
10 #pragma STDC FENV_ACCESS IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
12 #pragma STDC FENV_ACCESS OFF
14 float func_04(int x
, float y
) {
17 #pragma STDC FENV_ACCESS ON // expected-error{{'#pragma STDC FENV_ACCESS' can only appear at file scope or at the start of a compound statement}}
21 #pragma STDC FENV_ACCESS ON
23 CONST
float one
= 1.0F
;
24 CONST
float three
= 3.0F
;
25 CONST
float four
= 4.0F
;
26 CONST
float frac_ok
= one
/four
;
28 //expected-note@+2 {{declared here}}
30 CONST
float frac
= one
/three
;
32 CONST
int not_too_big
= 255;
33 CONST
float fnot_too_big
= not_too_big
;
34 CONST
int too_big
= 0x7ffffff0;
36 //expected-warning@+2{{implicit conversion}}
38 CONST
float fbig
= too_big
; // inexact
40 #define static_assert _Static_assert
43 e1
= (int)one
, e3
= (int)three
, e4
= (int)four
, e_four_quarters
= (int)(frac_ok
* 4)
45 static_assert(e1
== 1 && e3
== 3 && e4
== 4 && e_four_quarters
== 1, "");
48 // expected-error@+2 {{not an integer constant expression}} expected-note@+2 {{is not a constant expression}}
50 e_three_thirds
= (int)(frac
* 3)
52 if (one
<= four
) return 0;