Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR45881: Properly use CXXThisOverride for templated lambda
- `this` used in lambda expression parameter declarations needs no capture. - Set up CXXThisOverride for default template arguments of a lambda. A similar fix to this is c3d2ebb. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D102531
- Loading branch information
Yuanfang Chen
committed
Sep 8, 2021
1 parent
79c00d3
commit 61d1cce
Showing
5 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -emit-llvm-only %s | ||
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -fdelayed-template-parsing %s | ||
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -fms-extensions %s | ||
// RUN: %clang_cc1 -std=c++2a -fsyntax-only -fdelayed-template-parsing -fms-extensions %s | ||
|
||
namespace PR45881 { | ||
struct A { | ||
void f(); | ||
}; | ||
int id(A*); | ||
void A::f() { | ||
auto z = [*this](auto z2, decltype(z2(this)) z3){}; | ||
z(id,3); | ||
} | ||
|
||
struct B { | ||
void f(); | ||
}; | ||
void B::f() { | ||
auto z = []<typename TT, typename TTT=decltype(TT()(this))>(){return 0;}; | ||
z.template operator()<int(*)(B*)>(); | ||
} | ||
|
||
struct C { | ||
void f(); | ||
}; | ||
void C::f() { | ||
auto z = []<typename TT, decltype(TT()(this)) n>(){return 0;}; | ||
z.template operator()<int(*)(C*), 8>(); | ||
} | ||
} // namespace PR45881 |