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

CWG2565 Invalid types in the parameter-declaration-clause of a requires-expression #1695

Open
jensmaurer opened this issue Nov 9, 2023 · 1 comment
Labels
EWG Evolution paper needed An issue needs a paper to describe its solution

Comments

@jensmaurer
Copy link
Member

These two examples are very similar, but the second one is ill-formed per the wording despite implementations accepting it due to user demand:

  template <typename T>
  concept C = requires (typename T::type x) {
    x + 1;
  };

  static_assert(!C<int>);

vs.

  template <typename T>
  constexpr bool b = requires (T::type x) { x + 1; };

  static_assert(!b<int>);  // de-jure ill-formed, but widely accepted by implementations

In order to make the second case well-formed, the user needs to write a nested requires that checks for the presence of T::type first.

See CWG2565 for details.

@jensmaurer jensmaurer added the EWG Evolution label Nov 9, 2023
@erichkeane
Copy link
Collaborator

This was discussed during the Morning AM session in Tokyo, the following poll was taken:

CWG2565 EWG agrees that this is an issue worth considering, but would like to see a paper to propose a change.

SF F N A SA
1 17 7 1 0

Result: Consensus

Paper author not identified.

@hanickadot hanickadot added the paper needed An issue needs a paper to describe its solution label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EWG Evolution paper needed An issue needs a paper to describe its solution
Projects
None yet
Development

No branches or pull requests

3 participants