-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Clang: immediately-invoked lambda in template arg is not implicitly constexpr #114234
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
constexpr
Anything related to constant evaluation
lambda
C++11 lambda expressions
Comments
github-actions
bot
added
the
clang
Clang issues not falling into any other category
label
Oct 30, 2024
elbeno
added a commit
to elbeno/cpp-std-extensions
that referenced
this issue
Oct 30, 2024
Problem: - Writing `STATIC_ASSERT(cond, str)` means that `str` has to be formatted either as a separate variable or inline in the call. Solution: - Allow `STATIC_ASSERT(cond, fmt_str, args...)` where the string is formatted automatically. Notes: - Each argument must still be wrapped in `CX_VALUE`. Because there is no generic equivalent of `transform` for `__VA_ARGS__`. - A bug in clang (for which a workaround is in place) was discovered: llvm/llvm-project#114234 - `CX_VALUE` has been made more workable with GCC. GCC did not allow the `struct` definition inside the macro.
Yup, the
|
EugeneZelenko
added
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
lambda
C++11 lambda expressions
constexpr
Anything related to constant evaluation
and removed
clang
Clang issues not falling into any other category
labels
Oct 30, 2024
@llvm/issue-subscribers-clang-frontend Author: Ben Deane (elbeno)
An IILE as a template argument inside some other templates; this is the smallest SSCCE I could find.
template <auto Arg>
auto g() { return Arg; }
template <typename>
auto f() {
[]<typename>() {
// lambda is not treated as implicitly constexpr?
g<[] { return 123; }()>();
// explicit constexpr works
// g<[] () constexpr { return 123; }()>();
}.template operator()<int>();
}
int main() { f<int>(); } produces: <source>:8:9: error: no matching function for call to 'g'
8 | g<[] { return 123; }()>();
| ^~~~~~~~~~~~~~~~~~~~~~~
<source>:6:20: note: while substituting into a lambda expression here
6 | []<typename>() {
| ^
<source>:14:14: note: in instantiation of function template specialization 'f<int>' requested here
14 | int main() { f<int>(); }
| ^
<source>:2:6: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'Arg'
2 | auto g() { return Arg; }
| ^
1 error generated. |
Maybe related #97958 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
constexpr
Anything related to constant evaluation
lambda
C++11 lambda expressions
An IILE as a template argument inside some other templates; this is the smallest SSCCE I could find.
produces:
https://godbolt.org/z/x6heGf38x
The text was updated successfully, but these errors were encountered: