Skip to content

Commit 95440d6

Browse files
committed
Add example from #100341
1 parent ef71fb7 commit 95440d6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

clang/test/SemaCXX/cxx2b-deducing-this.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,10 @@ namespace std {
438438
constexpr strong_ordering strong_ordering::equal = {0};
439439
constexpr strong_ordering strong_ordering::greater = {1};
440440
constexpr strong_ordering strong_ordering::less = {-1};
441+
442+
template<typename T> constexpr __remove_reference_t(T)&& move(T&& t) noexcept {
443+
return static_cast<__remove_reference_t(T)&&>(t);
444+
}
441445
}
442446

443447
namespace operators_deduction {
@@ -965,3 +969,20 @@ void f();
965969
};
966970
void a::f(this auto) {} // expected-error {{an explicit object parameter cannot appear in a non-member function}}
967971
}
972+
973+
namespace GH100341 {
974+
struct X {
975+
X() = default;
976+
X(X&&) = default;
977+
void operator()(this X);
978+
};
979+
980+
void fail() {
981+
X()();
982+
[x = X{}](this auto) {}();
983+
}
984+
void pass() {
985+
std::move(X())();
986+
std::move([x = X{}](this auto) {})();
987+
}
988+
} // namespace GH100341

0 commit comments

Comments
 (0)