Debian Codegraph @

gcc/testsuite/g++.dg/contracts/pr113968.C

raw
1 // check that an invalid contract condition doesn't cause an ICE
2 // { dg-do compile }
3 // { dg-options "-std=c++2a -fcontracts " }
4
5 struct A
6 {
7 A (A&);
8 };
9 struct S
10 {
11 void f(A a)
12 [[ pre : a]] // { dg-error "could not convert" }
13 [[ pre : a.b]]// { dg-error "has no member" }
14 {
15
16 }
17 };
18 void f(A a)
19 [[ pre : a]] // { dg-error "could not convert" }
20 [[ pre : a.b]]// { dg-error "has no member" }
21 {
22 [[ assert : a ]]; // { dg-error "could not convert" }
23 [[ assert : a.b ]];// { dg-error "has no member" }
24 }
25
26 int
27 main ()
28 {
29 }