Skip to content

Commit 8dacc78

Browse files
Merge pull request gcc-mirror#91 from NinaRanns/retiring-contracts-cpp26-attr-tests
Retiring contracts cpp26 attr tests
2 parents f9100e8 + 150d27c commit 8dacc78

24 files changed

+29
-1376
lines changed

gcc/cp/parser.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31561,6 +31561,13 @@ cp_parser_contract_attribute_spec (cp_parser *parser, tree attribute)
3156131561
return error_mark_node;
3156231562
}
3156331563

31564+
if (flag_contracts_nonattr)
31565+
{
31566+
error_at (loc, "C++2x contracts are not available with "
31567+
"%<-fcontracts-nonattr%>");
31568+
return error_mark_node;
31569+
}
31570+
3156431571
return finish_contract_attribute (attribute, contract);
3156531572
}
3156631573

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+
}

gcc/testsuite/g++.dg/contracts/cpp26-attr/contract-assert_err.C

Lines changed: 0 additions & 39 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contract_specifier_seq.C

Lines changed: 0 additions & 113 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contracts-friend1.C

Lines changed: 0 additions & 36 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contracts-multiple-inheritance2.C

Lines changed: 0 additions & 32 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contracts-nested-class1.C

Lines changed: 0 additions & 23 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contracts-nested-class2.C

Lines changed: 0 additions & 38 deletions
This file was deleted.

gcc/testsuite/g++.dg/contracts/cpp26-attr/contracts-override.C

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)