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

[temp.deduct.general] Some cases in the example in p9 don't seem correct after CWG2672 #6809

Closed
frederick-vs-ja opened this issue Feb 15, 2024 · 1 comment

Comments

@frederick-vs-ja
Copy link
Contributor

In the example, the following invalid expression/type seem to be made in immediate context by CWG2672 (because only the lambda body is not in the immediate context), and thus should trigger SFINAE.

template <class T>
  auto h(T) -> decltype([x = T::invalid]() { });
void h(...);
h(0);               // error: invalid expression not part of the immediate context

template <class T>
  auto i(T) -> decltype([]() -> typename T::invalid { });
void i(...);
i(0);               // error: invalid expression not part of the immediate context

Also, it's unclear to me why the lambda body is instantiated in the following case (although implementations agree):

template <class T, std::size_t = sizeof([]() { T::invalid; })>
  void g(T);
void g(...);
g(0);               // error: invalid expression not part of the immediate context

The lambda expression is not called, so it seems to me that return type deduction doesn't happen, and thus the lambda body shouldn't be instantiated.

@frederick-vs-ja
Copy link
Contributor Author

Closing as duplicate of #6718.

@frederick-vs-ja frederick-vs-ja closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant