blob: c04c6c2db8831bd34d116292bebd0450dd30d48a [file] [log] [blame]
Serge Pavlov037861b2019-08-04 10:08:51 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3void f1(void) {
4 int x = 0;
5/* expected-error@+1 {{'#pragma fp_contract' can only appear at file scope or at the start of a compound statement}} */
6#pragma STDC FP_CONTRACT ON
7}
8
9void f2(void) {
10 #pragma STDC FP_CONTRACT OFF
11 #pragma STDC FP_CONTRACT ON
12}
13
14struct S1 {
15// expected-error@+1 {{this pragma cannot appear in struct declaration}}
16#pragma STDC FP_CONTRACT ON
17 float f1;
18};
19
20union U1 {
21 float f1;
22 float f2;
23// expected-error@+1 {{this pragma cannot appear in union declaration}}
24#pragma STDC FP_CONTRACT ON
25};
26
27class C1 {
28 float f1;
29// expected-error@+1 {{this pragma cannot appear in class declaration}}
30#pragma STDC FP_CONTRACT ON
31 float f2;
32};