Debian Codegraph @

libstdc++-v3/testsuite/26_numerics/stdckdint/2_neg.cc

raw
1 // { dg-do compile { target c++26 } }
2
3 #include <stdckdint.h>
4
5 void
6 test_add(int i, char c, bool b)
7 {
8 ::ckd_add(&i, c, 1); // { dg-error "here" }
9 ::ckd_add(&i, 1, c); // { dg-error "here" }
10 ::ckd_add(&i, b, 2); // { dg-error "here" }
11 ::ckd_add(&i, 2, b); // { dg-error "here" }
12 ::ckd_add(&c, 3, 3); // { dg-error "here" }
13 ::ckd_add((const int*)&i, 4, 4); // { dg-error "here" }
14 }
15
16 void
17 test_sub(int i, char c, bool b)
18 {
19 ::ckd_sub(&i, c, 1); // { dg-error "here" }
20 ::ckd_sub(&i, 1, c); // { dg-error "here" }
21 ::ckd_sub(&i, b, 2); // { dg-error "here" }
22 ::ckd_sub(&i, 2, b); // { dg-error "here" }
23 ::ckd_sub(&c, 3, 3); // { dg-error "here" }
24 ::ckd_sub((const int*)&i, 4, 4); // { dg-error "here" }
25 }
26
27 void
28 test_mul(int i, char c, bool b)
29 {
30 ::ckd_mul(&i, c, 1); // { dg-error "here" }
31 ::ckd_mul(&i, 1, c); // { dg-error "here" }
32 ::ckd_mul(&i, b, 2); // { dg-error "here" }
33 ::ckd_mul(&i, 2, b); // { dg-error "here" }
34 ::ckd_mul(&c, 3, 3); // { dg-error "here" }
35 ::ckd_mul((const int*)&i, 4, 4); // { dg-error "here" }
36 }
37
38 // { dg-prune-output "static assertion failed" }
39 // { dg-prune-output "pointer to 'const'" }