Skip to content

disallow contracts on defaulted functions #56

@NinaRanns

Description

@NinaRanns

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, but they get dropped since the constructor is trivial.

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.

testcase https://godbolt.org/z/Gfba6MaTv

struct S{
    S() pre(false) = default;
};
int main() {
  S s;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions