[all-commits] [llvm/llvm-project] 29b5f8: [Clang][Sema] Extract ellipsis location from CXXFo...
Younan Zhang via All-commits
all-commits at lists.llvm.org
Tue Jan 16 17:38:24 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 29b5f8f977af9b09aa8f56152baca04cf8750981
https://github.com/llvm/llvm-project/commit/29b5f8f977af9b09aa8f56152baca04cf8750981
Author: Younan Zhang <zyn7109 at gmail.com>
Date: 2024-01-17 (Wed, 17 Jan 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
M clang/test/SemaTemplate/concepts.cpp
Log Message:
-----------
[Clang][Sema] Extract ellipsis location from CXXFoldExpr for reattaching constraints on NTTPs (#78080)
We build up a `CXXFoldExpr` for immediately declared constraints as per
C++20 [temp.param]/4. This is done by
`formImmediatelyDeclaredConstraint` where an `EllipsisLoc` is essential
to determine whether this is a pack.
On the other hand, when attempting to instantiate a class template,
member templates might not be instantiated immediately, so we leave them
intact. For function templates with NTTPs, we reattach constraints if
possible so that they can be evaluated later. To properly form that, we
attempted to extract an ellipsis location if the param per se was a
parameter pack. Unfortunately, for the following NTTP case, we seemingly
failed to handle:
```cpp
template <Constraint auto... Pack>
void member();
```
The NTTPD Pack is neither an `ExpandedParameterPack` nor a
`PackExpansion` (its type does not expand anything). As a result, we end
up losing track of the constraints on packs, although we have them
inside the associated `CXXFoldExpr`.
This patch fixes that by extracting the ellipsis location out of the
previous constraint expression. Closes
https://github.com/llvm/llvm-project/issues/63837.
More information about the All-commits
mailing list