-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationlambdaC++11 lambda expressionsC++11 lambda expressions
Description
Clang version: 22.0.0git
Reproducer:
clang test.cpp
test.cpp
:
template<typename>
constexpr void bar() noexcept([]<typename...>() -> bool { return true; }()) {}
int main() {
bar<void>();
}
Clang output:
test.cpp:2:31: error: noexcept specifier argument is not a constant expression
2 | constexpr void bar() noexcept([]<typename...>() -> bool { return true; }()) {}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.cpp:2:16: note: in instantiation of exception specification for 'bar<void>' requested here
2 | constexpr void bar() noexcept([]<typename...>() -> bool { return true; }()) {}
| ^
test.cpp:5:5: note: in instantiation of function template specialization 'bar<void>' requested here
5 | bar<void>();
| ^
test.cpp:2:31: note: undefined function 'operator()<>' cannot be used in a constant expression
2 | constexpr void bar() noexcept([]<typename...>() -> bool { return true; }()) {}
| ^
test.cpp:2:31: note: declared here
Expected behavior:
Successfully produces essentially empty executable.
Environment:
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 779868de6975f6fd0ea17bb9a8e929037d3752d7)
Target: x86_64-w64-windows-gnu
Thread model: posix
Notes:
Removing -> bool
results in successful compilation:
template<typename>
constexpr void bar() noexcept([]<typename...>() /*-> bool*/ { return true; }()) {}
int main() {
bar<void>();
}
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationlambdaC++11 lambda expressionsC++11 lambda expressions