https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107791
Bug ID: 107791
Summary: Spurious -Wunused warning for artificial variable
introduced for post contract
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
int f(int x) [[pre: x > 0]] [[post r: r > 0]]
{
return -5;
}
int main()
{
f(42);
}
$ g++20 fail.cc -fcontracts -Wunused
fail.cc: In function 'int f(int, int)':
fail.cc:1:45: warning: unused parameter '__r' [-Wunused-parameter]
1 | int f(int x) [[pre: x > 0]] [[post r: r > 0]]
| ^