We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 37b0ff4 + 1ea125f commit 11f7474Copy full SHA for 11f7474
gcc/cp/contracts.cc
@@ -2763,6 +2763,7 @@ maybe_reject_param_in_postcondition (tree decl)
2763
if (flag_contracts_nonattr
2764
&& !TREE_READONLY (decl)
2765
&& TREE_CODE (decl) == PARM_DECL
2766
+ && should_constify_contract
2767
&& processing_postcondition
2768
&& !dependent_type_p (TREE_TYPE (decl))
2769
&& !CP_TYPE_CONST_P (TREE_TYPE (decl))
gcc/testsuite/g++.dg/contracts/cpp26/postcondition-with-nonconst.C
@@ -0,0 +1,11 @@
1
+// { dg-options "-std=c++23 -fcontracts -fcontracts-nonattr -fcontracts-nonattr-noconst" }
2
+
3
+// This should compile without error.
4
5
+class X {
6
7
+static int calc ()
8
+ post (alignment: 0 == (alignment & (alignment-1)));
9
10
+};
11
0 commit comments