Open
Description
int f() post(r: r > 0);
int f() post(r: r > 0);
or even
#define F(X) X; X
F(int f() post(r: r > 0));
the compiler claims
<source>:7:5: error: function redeclaration differs in contract specifier sequence
7 | int f() post(r: r > 0);
| ^ ~~~~~~~~~~~~~
<source>:7:9: note: in contract specified here
7 | int f() post(r: r > 0);
| ^ ~~~~~
<source>:6:9: note: contract previously specified with a non-equivalent condition
6 | int f() post(r: r > 0);
| ^ ~~~~~```
Contracts may be redeclared according to P2900 if they specify the same contract (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2900r8.pdf page 68, quote "A declaration E of a function f that is not a first declaration shall have either no function-contract-specifier-seq or the same function-contract-specifier-seq as any first declaration D reachable from E.")
Metadata
Metadata
Assignees
Labels
No labels