Skip to content

Commit 150d27c

Browse files
committed
adding a test that checks for attribute contracts with fcontracts-nonattr
1 parent 467e280 commit 150d27c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// test that attribute syntax is diagnosed when using -fcontracts-nonattr
2+
// { dg-do compile }
3+
// { dg-options "-std=c++2a -fcontracts -fcontracts-nonattr" }
4+
5+
int fun(int n) [[ pre : n > 0 ]]; // { dg-error "contracts are not available with" }
6+
int fun2(const int n) [[ post : n > 0 ]]; // { dg-error "contracts are not available with" }
7+
8+
int main()
9+
{
10+
int x;
11+
12+
[[assert: x >= 0]]; // { dg-error "ontracts are not available with" }
13+
14+
return 0;
15+
}

0 commit comments

Comments
 (0)