Debian Codegraph @

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

raw
1 // ensure that constants for contract levels are inserted into the binary when
2 // used and omitted when the runtime check is not generated
3 // { dg-do compile }
4 // { dg-options "-std=c++2a -fcontracts -fcontract-build-level=default" }
5 // { dg-final { scan-assembler-not "audit" } }
6 // { dg-final { scan-assembler "default" } }
7
8 int main()
9 {
10 int x = 1;
11 [[assert: x < 0]];
12 [[assert default: x < 0]];
13 [[assert audit: x < 0]];
14 return 0;
15 }