Skip to content

Commit 4eef0da

Browse files
committed
refactor(to_cpp1): remove useless non-rvalue context
1 parent 9e0b7c4 commit 4eef0da

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

regression-tests/test-results/pure2-last-use.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ auto issue_850() -> void{
529529
auto issue_857::n() && -> void{}
530530
auto issue_857::o0() && -> void { std::move(*this).n(); }
531531
auto issue_857::o1() && -> void { CPP2_UFCS(n)(std::move((*this))); }
532-
auto issue_857::o2() && -> void { CPP2_UFCS(n)(0); }
532+
auto issue_857::o2() && -> void { CPP2_UFCS(std::move(*this).n)(0); }
533533
auto issue_857::o3() && -> void { std::move(*this).n(0); }
534534
auto issue_857::o4() && -> void { n(std::move((*this))); }
535535
auto issue_857::p0() && -> void{

source/to_cpp1.h

+1-10
Original file line numberDiff line numberDiff line change
@@ -3220,18 +3220,9 @@ class cppfront
32203220
&& !lookup_finds_variable_with_placeholder_type_under_initialization(*i->id_expr)
32213221
)
32223222
{
3223-
auto is_type_scope_function = lookup_finds_type_scope_function(*i->id_expr);
3224-
if (is_type_scope_function) {
3225-
in_non_rvalue_context.push_back(true);
3226-
}
3227-
32283223
// The function name is the argument to the macro
32293224
auto funcname = print_to_string(*i->id_expr);
32303225

3231-
if (is_type_scope_function) {
3232-
in_non_rvalue_context.pop_back();
3233-
}
3234-
32353226
// First, build the UFCS macro name
32363227

32373228
auto ufcs_string = std::string("CPP2_UFCS");
@@ -3288,7 +3279,7 @@ class cppfront
32883279
// by leveraging the last use only in the non-member branch
32893280
if (auto last_use = is_definite_last_use(i->id_expr->get_token());
32903281
last_use
3291-
&& !is_type_scope_function
3282+
&& !lookup_finds_type_scope_function(*i->id_expr)
32923283
)
32933284
{
32943285
if (last_use->is_forward) {

0 commit comments

Comments
 (0)