[all-commits] [llvm/llvm-project] c9aaf3: [SemaCXX] Handle lack of TypeSourceInfo on special...
Bruno Cardoso Lopes via All-commits
all-commits at lists.llvm.org
Tue Jun 22 17:28:01 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c9aaf34b8db884faa3d3ced4d2fb88fd45697408
https://github.com/llvm/llvm-project/commit/c9aaf34b8db884faa3d3ced4d2fb88fd45697408
Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
Date: 2021-06-22 (Tue, 22 Jun 2021)
Changed paths:
M clang/lib/Sema/SemaDeclCXX.cpp
M clang/lib/Sema/SemaTemplateInstantiate.cpp
M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
M clang/lib/Sema/TreeTransform.h
A clang/test/SemaCXX/lambdas-implicit-explicit-template.cpp
Log Message:
-----------
[SemaCXX] Handle lack of TypeSourceInfo on special member functions in templated lambdas
During template instantiation involving templated lambdas, clang
could hit an assertion in `TemplateDeclInstantiator::SubstFunctionType`
since the functions are not associated with any `TypeSourceInfo`:
`assert(OldTInfo && "substituting function without type source info");`
This path is triggered when using templated lambdas like the one added as
a test to this patch. To fix this:
- Create `TypeSourceInfo`s for special members and make sure the template
instantiator can get through all patterns.
- Introduce a `SpecialMemberTypeInfoRebuilder` tree transform to rewrite
such member function arguments. Without this, we get errors like:
`error: only special member functions and comparison operators may be defaulted`
since `getDefaultedFunctionKind` can't properly recognize these functions
as special members as part of `SetDeclDefaulted`.
Fixes PR45828 and PR44848
Differential Revision: https://reviews.llvm.org/D88327
More information about the All-commits
mailing list