-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Clang rejects referencing local variable of class type to initialize template parameter in body of function template #49927
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
Comments
Reduced test case -- the lambda is unnecessary
Rejected with
See it live: https://godbolt.org/z/Yaes1h6M5 |
A workaround is to declare the variable |
The same happens when you invoke a lambda during constant evaluation, see #61029. |
@llvm/issue-subscribers-clang-frontend |
Ran into this today with void foo()
{
constexpr int x{1};
using A = decltype([]<int=x>{});
} Would be great to see this fixed. |
The original issue seems to have been fixed since around Clang 15. |
Oh weird. My issue seems new in clang-17. https://godbolt.org/z/5T358neaY Would it make more sense to create a new issue for this (or are you familiar with one that's active?). |
Yeah, I think that merits a new issue. |
Submitted as #107048. |
I'm closing this one - the case doesn't reproduce anyway. |
Extended Description
The following well-formed translation unit
is rejected by clang with the error message
See it live: https://godbolt.org/z/a5Mjh8ojv
A very similar translation unit,
is rejected for the same bogus reason.
The text was updated successfully, but these errors were encountered: