[PATCH] D136451: GH58368: Correct concept checking in a lambda defined in concept
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 21 06:56:10 PDT 2022
erichkeane created this revision.
erichkeane added a reviewer: aaron.ballman.
Herald added a subscriber: arphaman.
Herald added a project: All.
erichkeane requested review of this revision.
As that bug reports, the problem here is that the lambda's
'context-decl' was not set to the concept, and the lambda picked up
template arguments from the concept. SO, we failed to get the correct
template arguments in SemaTemplateInstantiate.
However, a Concept Specialization is NOT a decl, its an expression, so
we weren't able to put the concept in the decl tree like we needed.
This patch introduces a ConceptSpecializationDecl, which is the smallest
type possible to use for this purpose, containing only the template
arguments.
The net memory impliciation of this is turning a
trailing-objects into a pointer to a type with trailing-objects, so it
should be minor.
As future work, we may consider giving this type more responsibility, or
figuring out how to better merge duplicates, but as this is just a
template-argument collection at the moment, there isn't much value to
it.
https://reviews.llvm.org/D136451
Files:
clang/include/clang/AST/ASTNodeTraverser.h
clang/include/clang/AST/DeclTemplate.h
clang/include/clang/AST/ExprConcepts.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Basic/DeclNodes.td
clang/include/clang/Serialization/ASTBitCodes.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/DeclBase.cpp
clang/lib/AST/DeclTemplate.cpp
clang/lib/AST/ExprConcepts.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/Sema/SemaConcept.cpp
clang/lib/Sema/SemaLambda.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTCommon.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/AST/ast-dump-concepts.cpp
clang/test/SemaTemplate/concepts-lambda.cpp
clang/tools/libclang/CIndex.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136451.469591.patch
Type: text/x-patch
Size: 32565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221021/2fad17c1/attachment-0001.bin>
More information about the cfe-commits
mailing list