Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dcl.fct.def.default] Restrictions on what comparison operator function can be explicitly defaulted CWG2547 #5337

Open
xmh0511 opened this issue Mar 8, 2022 · 1 comment
Labels
cwg Issue must be reviewed by CWG.

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Mar 8, 2022

[dcl.fct.def.default] p1 just states:

A function that is explicitly defaulted shall

  • be a special member function or a comparison operator function ([over.binary]), and
  • not have default arguments.

If I don't omit some other rules, there are no more restrictions on what the comparison operator function shall satisfy.

Consider this example:

enum E{};
bool operator==(E,E) = default;

This example directly causes GCC to crash while Clang reports some diagnoses for which I cannot find the corresponding wording in the standard.

@jensmaurer jensmaurer changed the title The restriction on what comparison operator function that can be explicitly defaulted [dcl.fct.def.default] Restrictions on what comparison operator function that can be explicitly defaulted Mar 8, 2022
@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Mar 8, 2022
@jensmaurer
Copy link
Member

CWG2547

@jensmaurer jensmaurer changed the title [dcl.fct.def.default] Restrictions on what comparison operator function that can be explicitly defaulted [dcl.fct.def.default] Restrictions on what comparison operator function that can be explicitly defaulted CWG2547 Mar 8, 2022
@jensmaurer jensmaurer changed the title [dcl.fct.def.default] Restrictions on what comparison operator function that can be explicitly defaulted CWG2547 [dcl.fct.def.default] Restrictions on what comparison operator function can be explicitly defaulted CWG2547 Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG.
Projects
None yet
Development

No branches or pull requests

2 participants