https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124486
Bug ID: 124486
Summary: [contracts] Missing restriction on defaulted and
deleted functions
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dinka.ranns at gmail dot com
Target Milestone: ---
we currently do not implement the restriction on defaulted and deleted
functions from https://eel.is/c++draft/dcl.contract.func#6
This means we accept pre and post contract assertions on such functions, but
they get dropped since the constructor is trivial.
[dcl.contract.func/p6]
A virtual function ([class.virtual]), a deleted function
([dcl.fct.def.delete]), or a function defaulted on its first declaration
([dcl.fct.def.default]) shall not have a function-contract-specifier-seq.
struct S{
S() pre(false) = default;
};
int main() {
S s;
}