1 /* { dg-do compile } */
2 
3 struct X { int x; };
4 
test1(struct X x)5 int test1(struct X x)
6 {
7   if (x.x ==  1) return __builtin_fpclassify(1,2,3,4,5,x); /* { dg-error "non-floating-point argument" } */
8   if (x.x ==  2) return __builtin_isfinite(x); /* { dg-error "non-floating-point argument" } */
9   if (x.x ==  3) return __builtin_isinf_sign(x); /* { dg-error "non-floating-point argument" } */
10   if (x.x ==  4) return __builtin_isinf(x); /* { dg-error "non-floating-point argument" } */
11   if (x.x ==  5) return __builtin_isnan(x); /* { dg-error "non-floating-point argument" } */
12   if (x.x ==  6) return __builtin_isnormal(x); /* { dg-error "non-floating-point argument" } */
13   if (x.x ==  7) return __builtin_isgreater(x, x); /* { dg-error "non-floating-point arguments" } */
14   if (x.x ==  8) return __builtin_isgreaterequal(x, x); /* { dg-error "non-floating-point arguments" } */
15   if (x.x ==  9) return __builtin_isless(x, x); /* { dg-error "non-floating-point arguments" } */
16   if (x.x == 10) return __builtin_islessequal(x, x); /* { dg-error "non-floating-point arguments" } */
17   if (x.x == 11) return __builtin_islessgreater(x, x); /* { dg-error "non-floating-point arguments" } */
18   if (x.x == 12) return __builtin_isunordered(x, x); /* { dg-error "non-floating-point arguments" } */
19 
20   return 0;
21 }
22 
test2(double x)23 int test2(double x)
24 {
25   if (x ==  1) return __builtin_fpclassify(1,2,3,4,5); /* { dg-error "not enough arguments" } */
26   if (x ==  2) return __builtin_isfinite(); /* { dg-error "not enough arguments" } */
27   if (x ==  3) return __builtin_isinf_sign(); /* { dg-error "not enough arguments" } */
28   if (x ==  4) return __builtin_isinf(); /* { dg-error "not enough arguments" } */
29   if (x ==  5) return __builtin_isnan(); /* { dg-error "not enough arguments" } */
30   if (x ==  6) return __builtin_isnormal(); /* { dg-error "not enough arguments" } */
31   if (x ==  7) return __builtin_isgreater(x); /* { dg-error "not enough arguments" } */
32   if (x ==  8) return __builtin_isgreaterequal(x); /* { dg-error "not enough arguments" } */
33   if (x ==  9) return __builtin_isless(x); /* { dg-error "not enough arguments" } */
34   if (x == 10) return __builtin_islessequal(x); /* { dg-error "not enough arguments" } */
35   if (x == 11) return __builtin_islessgreater(x); /* { dg-error "not enough arguments" } */
36   if (x == 12) return __builtin_isunordered(x); /* { dg-error "not enough arguments" } */
37   return 0;
38 }
39 
test3(double x)40 int test3(double x)
41 {
42   if (x ==  1) return __builtin_fpclassify(1,2,3,4,5,x,x); /* { dg-error "too many arguments" } */
43   if (x ==  2) return __builtin_isfinite(x, x); /* { dg-error "too many arguments" } */
44   if (x ==  3) return __builtin_isinf_sign(x, x); /* { dg-error "too many arguments" } */
45   if (x ==  4) return __builtin_isinf(x, x); /* { dg-error "too many arguments" } */
46   if (x ==  5) return __builtin_isnan(x, x); /* { dg-error "too many arguments" } */
47   if (x ==  6) return __builtin_isnormal(x, x); /* { dg-error "too many arguments" } */
48   if (x ==  7) return __builtin_isgreater(x, x, x); /* { dg-error "too many arguments" } */
49   if (x ==  8) return __builtin_isgreaterequal(x, x, x); /* { dg-error "too many arguments" } */
50   if (x ==  9) return __builtin_isless(x, x, x); /* { dg-error "too many arguments" } */
51   if (x == 10) return __builtin_islessequal(x, x, x); /* { dg-error "too many arguments" } */
52   if (x == 11) return __builtin_islessgreater(x, x, x); /* { dg-error "too many arguments" } */
53   if (x == 12) return __builtin_isunordered(x, x, x); /* { dg-error "too many arguments" } */
54   return 0;
55 }
56 
test4(int i,double x)57 int test4(int i, double x)
58 {
59   if (x ==  1) return __builtin_fpclassify(i,2,3,4,5,x); /* { dg-error "non-const integer argument" } */
60   if (x ==  2) return __builtin_fpclassify(1,i,3,4,5,x); /* { dg-error "non-const integer argument" } */
61   if (x ==  3) return __builtin_fpclassify(1,2,i,4,5,x); /* { dg-error "non-const integer argument" } */
62   if (x ==  4) return __builtin_fpclassify(1,2,3,i,5,x); /* { dg-error "non-const integer argument" } */
63   if (x ==  5) return __builtin_fpclassify(1,2,3,4,i,x); /* { dg-error "non-const integer argument" } */
64   return 0;
65 }
66