Description
This issue is first found on clangd 17 shipped with CLion 2023.1.2 (22d9828), and reproduced on x86_64 clang trunk on compiler explorer (0a02f76) and clang-17 from apt.llvm.org (6875424).
This issue seems to only occur when:
- There's a class template (
template <class T> struct A
). - There's a constrained partial specialization (
template <C T> struct A<T>
). - That is effectively contrained by a
requires
expression (template <class T> concept C = requires ...;
). - That
requires
expression contains a lambda expression. - That contraint is not tested before.
Given a type T
which satisfies that constraint (i.e. static_assert(C<T>)
), clang trunk will fail to match the partial specialization template <C T> struct A<T>
if the constraint is not explicitly tested before (including static_assert(C<T>)
), and any test to the constraint will fail afterwards.
MRE#1: https://godbolt.org/z/rEfP7PcPc, lambda used as a simple requirement.
MRE#2: https://godbolt.org/z/GhqdnqMGb, lambda used inside parameter list with decltype
.
A slightly longer but more meaningful example: https://godbolt.org/z/xfGjrq7db.
Metadata
Metadata
Assignees
Type
Projects
Status